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

Re: Tip of the day: previous command output



On Sun, 22 Aug 2004, Vincent Lefevre wrote:

> On 2004-08-20 21:25:47 -0700, Bart Schaefer wrote:
> > 
> > Or you can get menu completion with
> > 
> >   zstyle ':completion:*' insert-kept menu
> 
> I was talking about another kind of menu (which could be useful for
> standard completion too). For instance, there could be a cursor for
> the (standard zsh) menu, or perhaps a number, to be able to choose
> one or several word candidates.
> 
> $ echo [TAB]
> [ab] ef  ij
>  cd  gh  kl

How is does this differ from menu selection?

Starting from my previous post, you need only add:

    zmodload -i zsh/complist
    zstyle ':completion:insert-kept-result:*' menu yes select

Then load something into $kept e.g. with "keep", and then type whatever 
keystrokes you have insert-kept-result bound to.

If that doesn't correspond to the behavior you're describing above, then 
there's something I'm still not understanding.

> or
> 
> $ echo [TAB]
> 1 ab  3 ef  5 ij
> 2 cd  4 gh  6 kl
>
> then typing some key followed by the number would insert the word.

Numbering the possible matches is difficult, if not impossible, without 
changing the guts of the completion C code, because the labels that may be 
shown along with each match are assigned to the _possible_ matches, not to 
the _actual_ matches.  E.g. when completing files, compadd may be given 
the name of every file in the directory, and then the completion internals 
winnows them down to the names that actually fit the prefix or suffix 
that's already on the line.  So the numbers to show cannot be known until 
immediately before the list is displayed, and hence can't be passed to
compadd by user-definable functions.

However, someone more ambitious than I might alter the complist module to 
provide this display and some corresponding menuselect keymap bindings.  
A question would be, what do you expect to happen when the list is too 
long to fit on one screen?



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