There is an annoying difference between zsh
and bash
tab completion:
Imagine you write some command and want to add something at the beginning of the line:
$ compute --some --stuff
then you jump to the beginning of the line and line and start to write sudo
(bad example - just to demonstrate)
$ sudcompute --some --stuff
^ <---cursor
bash
would let you complete sud
to sudo
while zsh
would try to complete sudcompute
.
So in this case you would have to write a space, jump back one character and try to tab-complete.
In case you're still used to bash
you would try to tab-complete after sud
and render the command you started to write into something utterly useless.
So for short: is there an option to let zsh
complete the phrase to the left of the cursor regardless whether or not it's terminated by a space?
The completion system go through a series of completers first. They'll try to find matches depending on the context (the command you've typed) using different completion functions. The Zsh module “zstyle” allows you to configure settings for a specific Zsh module or widget.
Zsh can handle bash completions functions. The latest development version of zsh has a function bashcompinit, that when run will allow zsh to read bash completion specifications and functions.
Just looked around in my .zshrc
file and I think this is what you want:
bindkey '^i' expand-or-complete-prefix
Where ^i
is <Ctrl-I>
which is usually tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With