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

Re: Is this possible -- menu completion for pattern

Will Maier <willmaier@xxxxxxx>:
> On Fri, Jan 05, 2007 at 03:17:28PM -0800, sam reckoner wrote:
> > What I want is to do
> >
> > % vi *.txt
> >
> > then press TAB and then see a menu I can navigate with the cursor
> > keys of the *.txt files in the current directory.
> I have the following in my ~/.zshrc:
> I believe I borrowed most of that from the GRML zshrc, which is a
> nice read, too.

I'm afraid that is not what the OP asked for.  What he is asking for
is this: vi *.txt<TAB> ...and then be dropped into a menu selection.

To do that at least this is needed:

zmodload zsh/complist
autoload -U compinit && compinit
bindkey '^I' complete-word
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' menu select yes

That is the minimum. To further tweak the completion system there are
various documents that may help. I think a good starting point to
start learning-by-doing the completion system is the wiki¹, that holds
lots of examples² on how to customize compsys and how to get started
in the first place³ (if you don't use the compinstall function).

Regards, Frank

¹ <http://zshwiki.org>
² <http://zshwiki.org/home/#examples>
³ <http://zshwiki.org/home/examples/compquickstart>

In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925

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