Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is there a way to do an automatic list-choices after successful completion of directory name?



On 7/7/06, Nikolai Weibull <now@xxxxxxxx> wrote:
I would like list-choices to be run whenever I have completed a
directory name, e.g.,

  $ cd ~/p<Tab>

completes to

  $ cd ~/projects/

Once completed, I'd like list-choices to be called so that I can see
what directories I have under ~/projects immediately, instead of
having to type another <Tab> right after the first one.

Yes, there is in fact a way to do what you want:

_expand-or-complete-with-list-choices-after-local-directories () {
 zle expand-or-complete
 if [[ $_lastcomp[tags] == ' local-directories ' ]]; then
   zle list-choices
 fi
}
zle -N expand-or-complete-with-list-choices-after-local-directories
_expand-or-complete-with-list-choices-after-local-directories
bindkey "^I" expand-or-complete-with-list-choices-after-local-directories

I'm sure you can come up with a better name for it, but that's what it does...

Comments?

 nikolai



Messages sorted by: Reverse Date, Date, Thread, Author