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

Re: Completing a unique prefix of "script" completes "script"



"Nikolai Weibull" wrote:
> Is there a way to make sure that both options, i.e., "script/" and
> "script ", are completed?

This is all rather frustrating, yet again...

Looks like you can get this with the combination of "setopt autocd" to
have local directories completed and "zstyle ':completion:*' group-name
''" to separate groups, so that it knows that it's ok to have both
matches for "script" separately.  I'm not sure why you would need
autocd---that looks like a bug, since you can execute commands by relative
paths anyway.

That's still not it, however, since you only get both if the completion
is otherwise ambiguous (i.e. script and script/ aren't sufficiently
different to show up separately).  Bizarrely, playing around suggests my
matcher-list is enough to make them appear "different":

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[.,_-]=**r:|=**'

> Also, is there a way to ignore the command "script" found in $path?
> Using the ignored-patterns style doesn't work, of course.  And that's
> basically the only thing I
> was able to think of.

You should be able to do it with the tag-order style so that it prefers
the directory if it's found.  However, there's something a bit screwy
here, too.

zstyle :completion::complete:-command-:: tag-order local-directories

should prefer local directory completion to everything else, only
offering other stuff if there's no local directory (or if you explicitly
use _next_tags).  But that doesn't work; you get all possibilities
together.

Explicitly listing other possibilities in a second argument doesn't
work, either.

However, it's not completely broken since

zstyle :completion::complete:-command-:: tag-order local-directories -

does work; that gives you only local directories and nothing else.  So
for some reason as soon as you try to specify an order it's assuming you
don't want an order.

You can cheat and unhash the command if you never use it.  "unhash
script" did seem to do the trick.  Note, however, that a "rehash" will
bring it back.

That's about five things I don't understand.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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