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

Re: Ignoring ~ when expanding scripts



On 21 May, hzoli@xxxxxxxxxxxx wrote:
> Dov Grobgeld wrote:
>> How can I make zsh ignore executables that end in ~ when doing
>> command completion? This is different from fignore where you want to
>> ignore parameters to the command.
> 
> As far as I know, there is no simple way to do that.  A hackish solution
> would be executing hash -f; unhash -m '*~' each time you change the $PATH.
> Unfortunately hash -f can be quite slow, but you can probably live with it
> since it is done anyway the first time you try to complete a command.

I'd say his problem is more when you are testing a script, and typing:

./scr[TAB]

You want:

./script-file _

You get:

./script-file[BEEP]_
./script-file ./script-file~

A hack like this:

compctl -C -g '*[^~](*)' + -c

when combined with the "hash -f ; unhash -m '*~'" hack, gives something
like the desired result, though it incorrectly completes for matching
executable files in the current directory, even if it is not (and it
should not be) in your PATH.  Anyone know how to fix that?

--Chris

-- 
We hold these truths to be self-evident:  That all men are created
equal...
    -- Thomas Jefferson, Prologue, "Declaration of Independence"
______________________________________________________________________
Chris Laas:  Unix, C++, Perl, Tcl/Tk / mailto:chrisl@xxxxxxxxxxxx
Limit[tech->Inf](words/acronyms)==0 / http://www.cybercom.net/~chrisl/



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