zsh-users
 help / color / mirror / code / Atom feed
* Prevent auto complete of non-executable files in path
       [not found] <CAL7A0-Ov8oT6Wzq=NfHhz_cEO0PQHFLhTx2V2ST2ZpSNwhotpg@mail.gmail.com>
@ 2020-05-27 16:53 ` Alan
  2020-05-27 19:25   ` Dave Wood
  2020-05-28  1:15   ` Alan
  0 siblings, 2 replies; 3+ messages in thread
From: Alan @ 2020-05-27 16:53 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

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!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Prevent auto complete of non-executable files in path
  2020-05-27 16:53 ` Prevent auto complete of non-executable files in path Alan
@ 2020-05-27 19:25   ` Dave Wood
  2020-05-28  1:15   ` Alan
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Wood @ 2020-05-27 19:25 UTC (permalink / raw)
  To: zsh-users

On 27/05/20 12:53,
Alan <8fvebtoeq87@gmail.com> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Prevent auto complete of non-executable files in path
  2020-05-27 16:53 ` Prevent auto complete of non-executable files in path Alan
  2020-05-27 19:25   ` Dave Wood
@ 2020-05-28  1:15   ` Alan
  1 sibling, 0 replies; 3+ messages in thread
From: Alan @ 2020-05-28  1:15 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

Thank you Dave, that worked great!


On Wed, May 27, 2020 at 12:53 PM Alan <8fvebtoeq87@gmail.com> wrote:

> 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!
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-28  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAL7A0-Ov8oT6Wzq=NfHhz_cEO0PQHFLhTx2V2ST2ZpSNwhotpg@mail.gmail.com>
2020-05-27 16:53 ` Prevent auto complete of non-executable files in path Alan
2020-05-27 19:25   ` Dave Wood
2020-05-28  1:15   ` Alan

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).