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

Re: Prevent auto complete of non-executable files in path



On 27/05/20 12:53,
Alan <8fvebtoeq87@xxxxxxxxx> put forth the proposition:
> Hi,
>
> I'm switching from bash to zsh (using version 5.8), and one thing that
> bothers me is that zsh auto completes non-executable files in my $PATH.
>
> For example:
>
> $ echo $PATH
> ~/bin:/usr/local/bin:/usr/bin:/bin
> $ ls -l ~/bin/
> -rwx------    1 user staff     95 Jun  5  2019  asdf1
> -rw-------    1 user staff     95 Jun  5  2019  asdf1~
> -rwx------    1 user staff     95 Jun  5  2019  asdf2
> -rw-------    1 user staff     95 Jun  5  2019  asdf3
> $ asd<TAB>
> external command
> asdf1
> asdf1\~
> asdf2
> asdf3
>
> ...whereas in bash, it would only auto complete asdf1 and asdf2 because
> those are the only 2 files in ~/bin/ that are executable:
>
> $ asd<TAB>
> asdf1
> asdf2
>
> How can I get zsh to only auto complete executable files in the $PATH?
>
> Thanks for your help, much appreciated!

Hi

Try:

setopt hashexecutablesonly

in your ~/.zshrc


--
Dave



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