3

I have zsh set up with Oh-My-Zsh. The z plugin allows me to jump to recently used directories.

When I type z name<TAB>, it autocompletes name from the list of recently visited dirs by matching name against the list.

Sometimes the result contains only a single entry, when I know there should be multiple. I have debugged the $reply variable and it happens if all entries have the same prefix, e.g. /path/to/dir, containing dirs with name In this case there is only the prefix in the autocomplete menu instead of full list of matched dirs. Hitting <TAB> again after expansion, triggers a new call to z script complete function now with the full common prefix instead of my search query , e.g. /path/to/dir

When I press <Shift+Tab> which is bound to reverse-menu-complete zsh properly selects the last item and shows the full list.

Is there a way to make Tab immediately show all completions, without first inserting the common prefix?

1

1 Answer 1

2

Add this to your .zshrc file, after sourcing Oh-My-Zsh:

bindkey '\t' menu-complete

Now Tab will behave exactly the same as ShiftTab, but in the opposite direction.


Alternatively, for more control over how completion behaves, install my Zsh Autocomplete plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.