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

Re: [BUG] Any type of file in command position gets misleadingly completed as 'executable file'



On Wed, Nov 10, 2021 at 2:01 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> The problem is in _files and it is two-fold:
> * _files always adds '*:all-files', which ignores the pattern passed
> with the -g flag.

There's a comment:
  # People prefer to have directories shown on first try as default.
  # Even if the calling function didn't use -/.

In fact the actual assumption is that most people prefer to have
SOMETHING completed rather than nothing, unless they've specifically
requested otherwise.

You can change this behavior by

zstyle ":completion:*" file-patterns ...

(although I'm not sure why that overrides list-dirs-first).  There's
even an explicit paragraph and example in the documentation explaining
how to do this.

> * Even though _files passes its file pattern tags to _next_label, if
> _files was passed a tag and/or description, it _always_ prefers these
> over the ones returned by _next_label's call to _description.

Someone else will have to comment on that.

> * The 'globbed-files' tag should be renamed to just 'files' and have a
> default description of 'file'.

That would actually break my zstyle setting for file-patterns.

> (As an aside, the docs speak of an
> 'other-files' tag used when zstyle list-directories-first is set, but
> this is never actually offered. Let's remove that, too.)

It appears "other-files" was (inadvertently?) removed by workers/36165
(Oliver, back in 2015).




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