Zsh: how to make tab completion, do not need space for the next word after the cursor?

There is an annoying difference between zsh and bash tab completion:

Imagine you are writing some kind of command and want to add something at the beginning of a line:

 $ compute --some --stuff 

then you go to the beginning of line and line and start writing sudo (a bad example is just for demonstration)

 $ sudcompute --some --stuff ^ <---cursor 

bash will let you finish sud before sudo , and zsh will try to complete sudcompute .

So, in this case you will need to write a space, bounce one character and try to perform a tab.

If you are still using bash , you will try to execute the tab after sud and visualize the command that you started writing to something completely useless.

So, for brevity: is there an option to zsh fill in the phrase to the left of the cursor, regardless of whether it ended with a space?

+6
source share
1 answer

Just looked into 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 a tab.

+6
source

All Articles