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

Re: [Bug] Doubled completions with suffix aliases and grouping

On Sun, Jul 5, 2020 at 12:24 PM Guido Cella <guidocella91@xxxxxxxxx> wrote:
> I think that the bug is adding files that aren't executable to the
> "executable file" grouping.

Aye, well, that's not exactly a bug either.  The position taken when
developing the completion code was that it's always better to offer
something that the user might possibly mean rather than to offer
nothing; i.e., err on the side of too much information rather than too
little.  Because _command_names uses _alternative, the two branches
(executables and suffix-aliases) don't "know" that the other might
produce overlapping matches, so each generates its result
independently, and when executables finds nothing, it falls back to
all files.

There are two elements of your specific example that could potentially
be considered bugs.  The first is that there's no file-patterns zstyle
for the "executables" tag; the closest you can get is to set one for
the :completion:complete:-command-:: context.  The second is that this
doesn't work:

zstyle :completion::complete:-command-::executables ignored-patterns '*(^*)'

Instead you have to do this:

zstyle :completion::complete:-command-::executables ignored-patterns '*(#q^*)'

However, I think you'll find if you do that latter, you'll get what you want.

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