zsh-users
 help / color / mirror / code / Atom feed
* Re: Ignoring ~ when expanding scripts
       [not found] <199705211154.OAA10534@glait.Orbotech.Co.IL>
@ 1997-05-21 19:38 ` Zoltan T. Hidvegi
  1997-05-21 22:45   ` Chris Laas
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan T. Hidvegi @ 1997-05-21 19:38 UTC (permalink / raw)
  To: Dov Grobgeld; +Cc: zsh-users

Dov Grobgeld wrote:
> I just downloaded version 3.1.0 of zsh and am trying to set up the
> startup files.

Do not use zsh-3.1.0.  It is a beta release.  It is probably confusing that
it does not have beta in its name, so I just removed this file from the ftp
archive.  Zsh-3.0.3 (stable) and zsh-3.1.2 (beta) will be out in about a
week, test releases are already available.

> 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.

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ignoring ~ when expanding scripts
  1997-05-21 19:38 ` Ignoring ~ when expanding scripts Zoltan T. Hidvegi
@ 1997-05-21 22:45   ` Chris Laas
  1997-05-22  2:59     ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Laas @ 1997-05-21 22:45 UTC (permalink / raw)
  To: zsh-users

On 21 May, hzoli@VNET.IBM.COM 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@cybercom.net
Limit[tech->Inf](words/acronyms)==0 / http://www.cybercom.net/~chrisl/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ignoring ~ when expanding scripts
  1997-05-21 22:45   ` Chris Laas
@ 1997-05-22  2:59     ` Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-05-22  2:59 UTC (permalink / raw)
  To: chrisl; +Cc: zsh-users

Chris Laas wrote:
> 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?

compctl -C -c -x 'C[0,*/*]' -g '*[^~](*)' + -g '*(*)'

The last *(*) is a fallback.  If the typed in prefix does not match
anything without a tilde, then, like fignore, it'll try to complete
allowing tilde.

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ignoring ~ when expanding scripts
@ 1997-05-22  4:37 Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-05-22  4:37 UTC (permalink / raw)
  To: zsh-users

I wrote:
> Chris Laas wrote:
> > 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?
> 
> compctl -C -c -x 'C[0,*/*]' -g '*[^~](*)' + -g '*(*)'
> 
> The last *(*) is a fallback.  If the typed in prefix does not match
> anything without a tilde, then, like fignore, it'll try to complete
> allowing tilde.

The above is still not perfect since it does not complete directories after
one typed any slash.  A better solution is

compctl -C -c -x 'C[0,*/*]' -g '*[^~](*)' + -c

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-05-22  4:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199705211154.OAA10534@glait.Orbotech.Co.IL>
1997-05-21 19:38 ` Ignoring ~ when expanding scripts Zoltan T. Hidvegi
1997-05-21 22:45   ` Chris Laas
1997-05-22  2:59     ` Zoltan Hidvegi
1997-05-22  4:37 Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).