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

Re: command completion



On 14 August 2011 22:59, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> I asked a question several years ago about command/function/etc.
> completion, but never had an answer. I'd like command completion
> to be preferred over directory completion.
>
> For instance, if I create an executable file blah-cmd and a directory
> blah-dir in the current directory ("." being in the $PATH), and do:
>
> % rehash
> % zstyle ':completion:*:complete:-command-:*' tag-order 'commands'
> % bl[TAB]
>
> then I can see that various commands are proposed, but not blah-cmd.
>
> ^Xh (_complete_help) at this point outputs:
>
> tags in context :completion::complete:-command-::
>    commands executables builtins functions aliases suffix-aliases reserved-words jobs parameters  (_alternative _command_names _autocd (eval))
>    commands                                                                                       (_path_commands _alternative _command_names _autocd (eval))
>    jobs                                                                                           (_jobs _alternative _command_names _autocd (eval))
>    parameters                                                                                     (_parameters _alternative _command_names _autocd (eval))
>
> Unfortunately not all the tags are described in the zshcompsys
> man page, and the description is quite short, so that I don't
> understand why blah-cmd hasn't been proposed.
>
> Then I've tried:
>
> % zstyle ':completion:*:complete:-command-:*' tag-order 'executables'
>
> but then both blah-cmd and blah-dir/ are proposed.
>
> Now, if I move blah-cmd somewhere else in $PATH, and use
>
> % zstyle ':completion:*:complete:-command-:*' tag-order 'commands'
> % blah[TAB]
>
> then only blah-cmd is proposed, as expected. However if I do:
>
> % mkdir ~/blah-hdir
> % cdpath=(. ~)
> % setopt AUTO_CD
> % blah[TAB]
>
> then both blah-cmd and blah-hdir/ are proposed. I don't see why
> blah-hdir/ should be regarded as a command.

Because it might contain executable files? What happens when you only
create the dir and don't do the other things?

-- 
Mikael Magnusson



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