3

I'm in a folder where I have the following files:

aaa1  aaa2  aaa3  bbb1  bbb2  bbc1  bbc2

and I have typed cd a at the prompt. Currently,

  • pressing Tab completes to cd aaa
  • then another Tab brings up the menu (aaa1/ aaa2/ aaa3/)
  • and finally a third Tab completes to cd aaa1/
  • and subsequent presses cycle through the menu

I'd like to combine the first and second Tab, so that:

  • pressing Tab completes to cd aaa and brings up the menu
  • pressing another Tab completes to cd aaa1/
  • subsequent presses cycle through the menu as usual

OR

  • pressing Tab completes to cd aaa
  • pressing another Tab brings up the menu and completes to cd aaa1/
  • subsequent presses cycle through the menu as usual

Is there any combination of (un)setopt or zstyle that can achieve this?

5

Hmm, this method appears to get directly to selecting "aaa1" and being in a loop-on-the-menu-items mode:

exec zsh -f
zmodload zsh/complist
autoload -U compinit; compinit
bindkey "^I" menu-select
cd a

As does the menucomplete option:

exec zsh -f
autoload -U compinit; compinit
setopt menucomplete
cd a

There is an autolist option, but that only lists the options with input of cd aaa but not your desired cd a case. Hmm! How about this:

exec zsh -f
autoload -U compinit; compinit
setopt nolistambiguous
cd a

This completes to cd aaa and shows the "aaa*" directories.

  • 2
    setopt nolistambiguous works perfectly. Thanks! – Soumya Jul 13 '16 at 17:47

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.