Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion: lookup argument using descriptions
On Thu, Jun 10, 2021 at 12:09:06 +0200, Mikael Magnusson wrote:
> On 6/10/21, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
>>
>> zstyle ':completion:*' menu select=0 search
>>
>> This will allow you to search right away after TAB.
>>
>> Roman.
>
> If you only want to do this sometimes (since defaulting to search mode
> for all completion is probably extremely annoying), you can bind it to
> a separate key;
[...]
> then you can press ^R to enter the search mode from there, if you also do
> bindkey -M menuselect '^R' history-incremental-search-forward
> (this is handled specially in menu select mode, and won't actually
> invoke history searching.)
Thank you so much Roman and Mikael, that was what I needed:)
How do you know about the 'search' option? I don't find it documented
anywhere, namely not in
https://zsh.sourceforge.io/Guide/zshguide06.html#l158
Also, the behaviour of history-incremental-search-forward widget in
menuselect keymap is vaguely documented (actually, misleading):
https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#Menu-selection
So now I wonder whether it is possible to highlight the isearch match
from within menuselect. Apparently zle_highlight='(isearch...)' doesn't work,
leaving me with zstyle ':completion:*:options:' list-colors ...
For this however I don't see any way to get the isearch *value* entered - I
see only ISEARCHMATCH_* that could be used by region_highlight(), and
LASTSEARCH. Yet LASTSEARCH also seems to be not updated inside menuselect:
$ o='=(#b)*(-- *($LASTSEARCH)*)=1;31=1;32=1;33'; zstyle -e ':completion:*:options' list-colors 'reply=("'"$o"'")'
$ ctrl+r - network - right-arrow (puts 'network' into $LASTSEARCH)
$ ping -[tab] (or whatever brings menu completion)
[...]
-n -- show network addresses as numbers - 'network' highlighted
[...]
$ ping -[enter menu selection] [ctrl-r for history-incremental-search-forward]
isearch: flood
In order to update LASTSEARCH i need to perform search inside ZLE itself
and then hit 'undo', which is a bit awkward.
So the question is: is there any way to update LASTSEARCH when using
bindkey -M menuselect '^R' history-incremental-search-forward
?
--
Tomasz Pala <gotar@xxxxxxxxxxxxx>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author