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

Re: _sh doing _normal completion



Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> writes:

> On Tue, 27 Mar 2018 15:34:12 +0200
> Leah Neukirchen <leah@xxxxxxxx> wrote:
>> the default _sh completion tries _files, then falls back to _normal.
>> However, sh, [t]csh and rc don't support this, and ksh/bash only
>> support it for actual shell scripts.
>> 
>> So I wonder if this is a reasonable completion?
>
> Do you mean falling back to _normal isn't sensible, i.e. it's not worth
> assuming you can specify an executable command or similar after the file
> name, since it's unlikely the shell can handle it? It's not a particularly
> sophisticated fallback, certainly.  It's possible you could think of a
> better way of searching for finding a script in the path, which I guess
> is the real intention.  Until someone does, this is probably going to
> stay the best we've got.

The main problem is that it floods the reasonable expansions (from .)
with the full contents of $PATH.

As discussed in #zsh I now use:
zstyle ':completion:*:(sh|rc):*' tag-order '! commands builtins'

(POSIX /bin/sh may do a PATH lookup, but dash and OpenBSD sh don't.)

thx,
-- 
Leah Neukirchen  <leah@xxxxxxxx>  http://leah.zone



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