Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to accept a particular directory during directory selection for further tab completion
On 4/22/22, zzapper <zsh@xxxxxxxxxxxxxx> wrote:
> Hi
>
> cd aa<tab>
>
> aaa/ aab/ aac/
>
>
> I want to accept aab/ then carry on completing
>
>
> I do this by manually deleting and then retyping the trailing slash.
>
> But I guess there is an official way to do this?
If you press a key bound to accept-and-infer-next-history during menu
selection, then it will be accepted and menu selection will be
automatically started again. There is no such key bound by default but
you can do
bindkey -M menuselect whateverkey accept-and-infer-next-history
manpage entry:
accept-and-infer-next-history
accepts the current match and then tries completion with menu selec‐
tion again; in the case of files this allows one to select a direc‐
tory and immediately attempt to complete files in it; if there are no
matches, a message is shown and one can use undo to go back to comple‐
tion on the previous level, every other key leaves menu selection
(including the other zle functions which are otherwise special during
menu selection)
relatedly, accept-and-hold (or accept-and-menu-complete, they do the
same thing here) is also useful:
accept-and-hold, accept-and-menu-complete
accept the currently inserted match and continue selection allowing to
select the next match to insert into the line
If you press this while several levels deep, you will insert one of
the matches to the command line, and stay in the same directory in
menu selection so you don't have to navigate back there to insert the
next file you want (or slightly more optimally, copy-earlier-word and
erase to last slash)
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author