Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion: lookup argument using descriptions
- X-seq: zsh-users 26772
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: Tomasz Pala <gotar@xxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: completion: lookup argument using descriptions
- Date: Thu, 10 Jun 2021 12:09:06 +0200
- Archived-at: <https://zsh.org/users/26772>
- In-reply-to: <CAN=4vMqCc5UsG73s3PdQzW_aqAf0sak4SowSonbK8aif+A_2kg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <20210610093007.GA6653@polanet.pl> <CAN=4vMqCc5UsG73s3PdQzW_aqAf0sak4SowSonbK8aif+A_2kg@mail.gmail.com>
On 6/10/21, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> On Thu, Jun 10, 2021 at 11:31 AM Tomasz Pala <gotar@xxxxxxxxxx> wrote:
>>
>> Hello,
>>
>> sometimes I find myself looking for appropriate option by reading down
>> all the descriptions of the arguments before going straight to the
>> documentation to simply /search for some phrase. I wonder: would that be
>> possible directly from zle?
>
> Try this:
>
> zmodload zsh/complist
> setopt menucomplete
> 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;
zle -C menu-select-search menu-complete _generic
zstyle ':completion:menu-select-search:*' menu select search
zstyle ':completion:menu-select-search:*' completer _oldlist _expand _complete
bindkey "^[M" menu-select-search # alt-shift-m
or if you already have a key bound to start regular menu selection, eg
bindkey "^[m" menu-select
(this requires no other setup, it's a stock widget)
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.)
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author