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

Re: Zsh includes directories in tab completion

On 2 Jan 2019, at 08:41, Saverio M. <saverio.pub2@xxxxxxxxx> wrote:
>On my system, zsh tab-completion includes directories present in the path, in
>addition to files, which is confusing and error prone.
>Is this intended?

Yes, by default the shell doesn't check the types of files it finds in your
PATH, it just hashes them all. You can enable the option hash_executables_only
to change that:

  When hashing commands because of HASH_CMDS, check that the file to be hashed
  is actually an executable. This option is unset by default as if the path
  contains a large number of commands, or consists of many remote files, the
  additional tests can take a long time. Trial and error is needed to show if
  this option is beneficial.

It makes hashing slower in general, but like it says you'll have to see if
that's bothersome for you.

If you'd rather not do that, and it's only a problem for a few specific files,
you might be able to use the ignored-patterns style instead:

  zstyle ':completion:*:commands' ignored-patterns myscript


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