Comments (19)
Yeah I understand that it might be tricky but it's a fairly big annoyance since it deviates so much from normal shell behavior when hitting tab. You really expect it to complete with the right thing, so it throws me off a lot when I quickly tab and enter and it ends up inserting something completely different.
from zsh-autocomplete.
This is something I've tried to solve before, but did not commit, because it impacted performance significantly. This is because I cannot control the sorting directly. I have to use the completion system's grouping mechanism to fake it.
However, now that we have asynchronous completion, I could give it another try and at least provide it as an option, with a note about the performance hit. 🙂
from zsh-autocomplete.
@Dwight-D Alright, here it is on the dev
branch. Please try it out. 🙂
from zsh-autocomplete.
Nice! It seems to be fixed for a few issues, but the example I posted here still fails. I'll keep using it throughout the day and see if I can figure out any pattern to it.
from zsh-autocomplete.
@Dwight-D If the example you posted here fails, then you have not enabled the feature. You should have the following in your .zshrc
file, before sourcing zsh-autocomplete
:
zstyle ':autocomplete:tab:*' completion insert
from zsh-autocomplete.
Okay, my bad. This is great, I love it!
from zsh-autocomplete.
No, wait, there are some weird quirks
➜ ls
bar bartest baz
➜ cd bar
bar/ bartest/
\t
➜ cd bar/
Expected behavior: cycle through bar/
and bartest
, or possibly insert bartest
instead of autocompleting to bar/
.
I also noticed that some autocompletions are now inserting space when I tab partway through a path.
➜ kubectl apply -f kubernetes/deploym
kubernetes/deployments/
\t
➜ kubectl apply -f kubernetes/deployments/ <--- SPACE HERE
edit-last-applied set-last-applied view-last-applied
Expected behavior: no space at the end of completion deployments
, allow me to keep completing/cycling through file paths:
➜ kubectl apply -f kubernetes/deployments/
foo.yml bar.yml baz.yml
This last one I'm not sure if it's new behavior, can't recall when I last used kubectl like this. I haven't noticed it for any other programs yet, it doesn't happen for all completions. Might be an error in kubectl completions but it didn't use to behave like this without the plugin.
from zsh-autocomplete.
Expected behavior: cycle through
bar/
andbartest
Thanks, that's easy to change.
or possibly insert
bartest
instead of autocompleting tobar/
.
Why? What's the logic behind that? I would expect it to complete bar/
since it's the first in the list.
Expected behavior: no space at the end of completion deployments, allow me to keep completing/cycling through file paths
I cannot reproduce that, because I don't have access to kubectl
. It works for me fine with normal paths. Do you have some other way I could reproduce this?
from zsh-autocomplete.
Why? What's the logic behind that? I would expect it to complete
bar/
since it's the first in the list.
Completing to bar/
doesn't make sense because it's not an unambiguous match, it's not a substring of bartest
. However cycling through them works fine.
Honestly I couldn't remember the default shell behavior here which is why I threw in the bartest
, I was thinking that maybe it kept on completing longer directory names instead of inserting the slash. But I tested it out in bash and it will apparently be considered an ambiguous match and present both options, so just forget I said that.
I cannot reproduce that, because I don't have access to kubectl. It works for me fine with normal paths. Do you have some other way I could reproduce this?
No, that's the only error I've run across so far but I'll let you know if I find any others. Most of the time it seems to work fine for me as well.
from zsh-autocomplete.
@Dwight-D It's now available on the master
branch.
from zsh-autocomplete.
Hi,
Awesome lib, thanks!
Anyway, I wanted to achieve common prefix as well. Generally it works fine, but when I start the command with sudo
it doesn't. Root uses zsh too, with a symlink to .zshrc
.
from zsh-autocomplete.
@vendelin8 It seems to work for me. Can you please give me some test cases for which it fails?
from zsh-autocomplete.
My idea was sudo updatedb
from zsh-autocomplete.
My related ~/.zshrc
part looks like
zstyle ':autocomplete:tab:*' insert-unambiguous yes
. /usr/share/zsh/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh
And without sudo it works fine.
$ ls -l /root/.zshrc
lrwxrwxrwx 1 root root 18 dec 27 22.53 /root/.zshrc -> /home/panda/.zshrc
from zsh-autocomplete.
My idea was
sudo updatedb
And without sudo it works fine.
That is because you get more matches with sudo
than without. Zsh only supports getting longest substring that is common to all completions listed. The additional completions you get when doing sudo
makes it so there's no longer any substring common to all matches.
I'll see if I can make the matching a bit more strict/less fuzzy (perhaps only for users who have insert-unambiguous
enabled), so that you get fewer matches, but even then, there's no guarantee that it will work for that particular case.
from zsh-autocomplete.
I'd be happy with a common prefix, if there's an option for that. Is it?
from zsh-autocomplete.
That's the one I'm talking about. There is no difference.
However, I did some more testing and I found that there's actually a bit more going on. I'm working on a patch that will improve this.
from zsh-autocomplete.
@vendelin8 It should be better now. Please try again.
from zsh-autocomplete.
Awesome, it works fine, thank you!
from zsh-autocomplete.
Related Issues (20)
- Can we support command line completion before history completion? HOT 1
- Inserting from history in Vim normal mode removes the last character HOT 2
- Down arrow key doesn't work with bindkey -v
- Color of Suggestions HOT 2
- `*.tar.zst` is not considered for `tar -xvf`
- Feature Request: Flag or option to disable variable preview added in Issue #161
- Hidden text HOT 2
- On Debian LXC Containers The first characters entered are displayed twice HOT 4
- Is there a way to disable the up-arrow search history? HOT 10
- Cursor Blinking to New Line on Suggestions HOT 2
- Up and down arrow key not working HOT 1
- Print widget above the prompt
- Unexpected full completion on TAB
- Incompatibility with zoxide z <space><tab> shortcut HOT 5
- Print current option help
- Conflict between zoxide, zsh-autocomplete, and fzf results in erroneous behavior HOT 1
- Bug with zsh-syntax-highlighting: unhandled ZLE widget HOT 3
- Available completions not shown for commands with slow `compdef` functions
- Enable suggestion scrolling without setting a hard limit HOT 1
- Autocomplete do not work on my zsh terminal HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zsh-autocomplete.