help / color / mirror / code / Atom feed
From: Tomasz Pala <gotar@polanet.pl>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
	Zsh Users <zsh-users@zsh.org>
Subject: Re: completion: lookup argument using descriptions
Date: Sun, 13 Jun 2021 12:06:02 +0200	[thread overview]
Message-ID: <20210613100602.GA27466@polanet.pl> (raw)
In-Reply-To: <CAHYJk3TyujHtm8_kOOQ9FBkKQkHN0SbOECtP1JZW8wp81WGCyA@mail.gmail.com>

On Thu, Jun 10, 2021 at 12:09:06 +0200, Mikael Magnusson wrote:

> On 6/10/21, Roman Perepelitsa <roman.perepelitsa@gmail.com> 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

Also, the behaviour of history-incremental-search-forward widget in
menuselect keymap is vaguely documented (actually, misleading):

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@pld-linux.org>

  reply	other threads:[~2021-06-13 10:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  9:30 Tomasz Pala
2021-06-10  9:45 ` Roman Perepelitsa
2021-06-10 10:09   ` Mikael Magnusson
2021-06-13 10:06     ` Tomasz Pala [this message]
2021-06-13 10:43       ` Roman Perepelitsa
2021-06-16 10:04         ` Tomasz Pala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210613100602.GA27466@polanet.pl \
    --to=gotar@polanet.pl \
    --cc=mikachu@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-users@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).