5

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?

1 Answer 1

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.

1
  • 2
    setopt nolistambiguous works perfectly. Thanks!
    – user4941
    Commented Jul 13, 2016 at 17:47

You must log in to answer this question.