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

Re: _history-complete-older and _history-complete-newer



On Thu, Nov 13, 2025 at 4:33 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> _history-complete-older and _history-complete-newer are not documented.

The documentation is listed for _history-complete-word which does the
same as the 'older' variant, this can probably be clarified (the \e,
default binding for the 'newer' variant is also not documented from
what I can see).

> qaa% autoload -U compinit
> qaa% compinit
> qaa% bindkey | grep _history-complete
> "^[," _history-complete-newer
> "^[/" _history-complete-older
>
> With a big history:
>
> zsh: do you wish to see all 29860 possibilities (29866 lines)?
>
> I'm wondering how this can make sense to output such a long list
> non interactively.

              range  This is used by the _history completer and the
_history_complete_word
                     bindable command to decide which words should be completed.

                     If  it is a single number, only the last N words
from the history will
                     be completed.

                     If it is a range of the form `max:slice', the
last slice words will be
                     completed;  then  if  that  yields  no matches,
the slice words before
                     those will be tried and so on.  This  process
stops  either  when  at
                     least one match has been found, or max words have
been tried.

                     The default is to complete all words from the
history at once.

I use 50000:2000 as the value which I've been happy with since I set it.

> Moreover, the tab key should not be regarded as a yes.

This is not configurable, but if you want to change it, it's in
getzlequery in zle_utils.c

You may wish to set the list-prompt style so that you only get one
screenful of results at a time (this will also skip the prompt in the
first place). There are also a lot of options to control whether
listings are shown or not and for how many matches, and explicit
widgets for showing the list etc.

-- 
Mikael Magnusson




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