zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zzapper <zsh@rayninfo.co.uk>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: How to accept a particular directory during directory selection for further tab completion
Date: Fri, 22 Apr 2022 13:05:53 +0200	[thread overview]
Message-ID: <CAHYJk3Qe-bsV1YSnbQVRrB11W6kjTBAGfWrZFFFiQvdWvggU=Q@mail.gmail.com> (raw)
In-Reply-To: <e6e3aea4-64ec-82ad-86a2-c1f68dab1e6f@rayninfo.co.uk>

On 4/22/22, zzapper <zsh@rayninfo.co.uk> 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


  parent reply	other threads:[~2022-04-22 11:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  9:15 zzapper
2022-04-22  9:46 ` Jérémie Roquet
2022-04-22  9:59   ` zzapper
2022-04-22 11:05 ` Mikael Magnusson [this message]
2022-04-22 16:27   ` zzapper
2022-04-24 11:05 ` zzapper

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to='CAHYJk3Qe-bsV1YSnbQVRrB11W6kjTBAGfWrZFFFiQvdWvggU=Q@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=zsh-users@zsh.org \
    --cc=zsh@rayninfo.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.vuxu.org/mirror/zsh/

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).