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

Re: menuselect and history



On Apr 20,  9:08am, Felix Rosencrantz wrote:
}
} As Matthias predicted, this is cool. It would be even cooler if it
} could be connected to the incremental search commands. The list
} presented would be winnowed as the user types the search term.

This might be possible, but it'd be significantly more difficult.
Menu selection just doesn't work that way -- the incremental search
commands scan through the listing, they don't narrow it -- so what
in effect you'd need to do is exit from and restart completion on
every keystroke.

However, given the _history_select function that I posted, you can
do this:

autoload -U incremental-complete-word
zle -N incremental-complete-word
bindkey '^Xi' incremental-complete-word
zstyle :incremental list yes
zstyle ':completion:incremental:*' completer _history_select ...

(where "..." are whatever completers you normally would want to try)
and then when you type C-x i on the command word you should get exactly
what you just asked for, except that you _can't_ also scroll around in
the list of choices.

This does show a bug in incremental-complete-word -- the way that it
computes its prompt pre-dates some changes in the conventions for the
values of the _lastcomp association.  (There are likely to be other
outdated things about i-c-w that are problems waiting to happen.)



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