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

Re: command completion



On 2011-08-14 23:09:37 +0200, Mikael Magnusson wrote:
> On 14 August 2011 22:59, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
[...]
> > 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?

Then what?

First, zsh does not complete to such executable files, so that's
a wrong reason. Moreover such executable files cannot be executed
anyway, because they are not in the path!

And if the current directory happens to be $HOME, zsh does not
propose blah-hdir/ in the completions.

It seems the reason is that the directory (and possible subdirectories)
is a candidate for the autocd. But my point is that such a directory is
not a command ('commands' was specified first in tag-order).

> What happens when you only create the dir and don't do the other
> things?

Both the "cdpath=(. ~)" and "setopt AUTO_CD" are necessary to make
this (IMHO incorrect) behavior appear. Otherwise blah-hdir/ is not
proposed as a completion.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)



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