From: Thomas Lauer <thomas.lauer@virgin.net>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Completion... but only for the extension part
Date: Sun, 31 Jul 2022 17:33:37 +0100 [thread overview]
Message-ID: <3ibdeh5ne7prrsaq8394994usvq22q7afm@tlc.com> (raw)
In-Reply-To: <CAHYJk3SKZBbwZP9hLXiifph2dUq=iGCHLUwCAseXpzAMiN+iNQ@mail.gmail.com>
From: Mikael Magnusson <mikachu@gmail.com>
> On 7/31/22, Thomas Lauer <thomas.lauer@virgin.net> wrote:
> > Sorry if this is in the Fine Manual but I couldn't find it (and googling
> > also brought no great enlightenment).
> >
> > I have directories with many files in them which all have rather long
> > extensions (12+ chars). There can be quite a few separate extensions,
> > say "*.winter-music" or "*.spanish-photos"... you get the idea.
> >
> > So, often I want to complete filenames as normal but sometimes I want to
> > limit completion to files with just one specific extension, say
> > "*.indonesian-videos". So... I'd like to type "*.indo" and then press
> > <whatever> to get "*.indonesian-videos" which in its turn will complete
> > only those files. The problem is the <whatever> bit... or rather a
> > function that does that and can be bound to <whatever>. Do I have to
> > write such a function or is there something in the completion system
> > that will do this OOTB?
>
> There is _extensions, you probably want it on a separate keybind from
> normal completion, look at the _all_matches entry for an example of
> how to do that.
>
> https://www.zsh.org/mla/workers/2014/msg00230.html is the thread for
> the patch that adds _extensions if you're curious.
Right. That _extensions extension works, thanks for the pointer!
The only problem now is that my "normal" completions add a space after
the completion and that happens here as well. As I want to use these
completions as bases for further completions that means I have to
backspace and press <tab> again. I have no problem with the <tab> but
not adding a space would make things a bit faster. Alas I've not found
the right place to do that.
I have this
zstyle ':completion:*' menu select=2 interactive
if that helps.
Again thanks, much appreciated!
T
next prev parent reply other threads:[~2022-07-31 16:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-31 13:01 Thomas Lauer
2022-07-31 15:34 ` Mikael Magnusson
2022-07-31 16:33 ` Thomas Lauer [this message]
2022-08-03 16:50 ` Thomas Lauer
2022-08-03 17:02 ` Bart Schaefer
2022-08-03 17:44 ` Thomas Lauer
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=3ibdeh5ne7prrsaq8394994usvq22q7afm@tlc.com \
--to=thomas.lauer@virgin.net \
--cc=mikachu@gmail.com \
--cc=zsh-users@zsh.org \
/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).