zsh-users
 help / color / mirror / code / Atom feed
* Compctl question
@ 1998-02-02 12:57 Erwin J. van Eijk
  1998-02-02 15:58 ` Adam R. Paul
  0 siblings, 1 reply; 5+ messages in thread
From: Erwin J. van Eijk @ 1998-02-02 12:57 UTC (permalink / raw)
  To: zsh-users

Hi

This is in the manpage somewhere, but I can't quite get a fix on how
to do it.

I have a command named really, which has the following cmd line:

really [-u username] [-s shell] command

And I want to compose a compctl for it, but I can't quite do it.

Thanx
EJ
--
+--------------------+ There's only one rule:
| Erwin J.  van Eijk | 		The golden rule.
| eijk@acm.org       | He who owns the gold, rules.
+--------------------+


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

* Re: Compctl question
  1998-02-02 12:57 Compctl question Erwin J. van Eijk
@ 1998-02-02 15:58 ` Adam R. Paul
  0 siblings, 0 replies; 5+ messages in thread
From: Adam R. Paul @ 1998-02-02 15:58 UTC (permalink / raw)
  To: Erwin J. van Eijk; +Cc: zsh-users

On 02 Feb, 1998, Erwin J. van Eijk put forth:
> Hi
> 
> This is in the manpage somewhere, but I can't quite get a fix on how
> to do it.
> 
> I have a command named really, which has the following cmd line:
> 
> really [-u username] [-s shell] command
> 
> And I want to compose a compctl for it, but I can't quite do it.

Something like:

getshells() {
	reply=($(sed '/#.*/d' /etc/shells))
}
compctl -l '' -x 'c[-1,-u]' -u -x 'c[-1,-s]' -K getshells -- really

should work (it appears to for me at least...)

_Adam

-----
Adam R. Paul    - adamp@sco.com 
SCO Engineering - from std import disclaimer

Oahagggoo.  Iongah agbh ouht chmmaeao thg thm'eiagg.  


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

* Re: compctl question
@ 1999-05-10 11:15 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 1999-05-10 11:15 UTC (permalink / raw)
  To: zsh-users


Philip J. Hollenback wrote:

> 1. How do you get around the fact that the shell grabs the '='?  Can
> you turn that off for this one command?

Just use `-x "s[=]"' or `-x "S[=]"':

  comcptl -x 's[=]' -W ~/mail -f -- bar

> 2. Is there a way to write a completion that rewrites the what is
> already on the command line?  For instance, if I typed in this:

This is a bit tricky:

  foo() { reply=( ~/mail/${1[2,-1]}*${2}(N:t) ); reply=( \\\=$^reply ); }
  compctl -x 'S[=],S[\\=]' -UQK foo -- bar

But this has the side-effect of turning on menucompletion if automenu
is set.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: compctl question
  1999-05-07 17:44 compctl question Philip J. Hollenback
@ 1999-05-07 18:02 ` Sweth Chandramouli
  0 siblings, 0 replies; 5+ messages in thread
From: Sweth Chandramouli @ 1999-05-07 18:02 UTC (permalink / raw)
  To: zsh-users

On Fri, May 07, 1999 at 10:44:46AM -0700, Philip J. Hollenback wrote:
> I'm using zsh 3.1.5, and I'm trying to develop a completion for mutt.
> Here's what I currently have:
> 
> 
> mutt: if -f, -i, -a, or -H is given, complete files,
> # and if -f+ (or -f=, or -f +) is given, complete folders in
> # ~/mail.  Also complete options after -. 
> # Note that '-f =' can't be completed because '=' is grabbed by the
> # shell.  It needs to be protected with a '\', but I don't know how to
> # make the completion do that.
> # Don't complete users because I never mail anyone on my own system.
> compctl -x 's[+] c[-1,-f],s[-f+],s[-f=]' -W ~/mail -f \
>   - 's[-[fiaH]],C[-1,-[fiaH]]' -f \
>   - 's[-]' -k '(a b c e f F H i m n p R s v x y z Z h)' \
>   -- mutt
> 
> 
> I like to open mailboxes in my mail directory thusly:
> 
> # mutt -f =mailbox
> 
> That doesn't work, Apparently because the shell does something with
> words that start with '='.  I can't complete on =mailbox either,
> for the same reason.
	the EQUALS option, when set, tells the shell to interpret
# =foo
	as
# $(which foo)
	which is probably what is causing your problems.  if you don't
make use of that functionality, you can just unsetopt EQUALS and it
should work the way you would expect.

	-- sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


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

* compctl question
@ 1999-05-07 17:44 Philip J. Hollenback
  1999-05-07 18:02 ` Sweth Chandramouli
  0 siblings, 1 reply; 5+ messages in thread
From: Philip J. Hollenback @ 1999-05-07 17:44 UTC (permalink / raw)
  To: zsh-users

I'm using zsh 3.1.5, and I'm trying to develop a completion for mutt.
Here's what I currently have:


mutt: if -f, -i, -a, or -H is given, complete files,
# and if -f+ (or -f=, or -f +) is given, complete folders in
# ~/mail.  Also complete options after -. 
# Note that '-f =' can't be completed because '=' is grabbed by the
# shell.  It needs to be protected with a '\', but I don't know how to
# make the completion do that.
# Don't complete users because I never mail anyone on my own system.
compctl -x 's[+] c[-1,-f],s[-f+],s[-f=]' -W ~/mail -f \
  - 's[-[fiaH]],C[-1,-[fiaH]]' -f \
  - 's[-]' -k '(a b c e f F H i m n p R s v x y z Z h)' \
  -- mutt


I like to open mailboxes in my mail directory thusly:

# mutt -f =mailbox

That doesn't work, Apparently because the shell does something with
words that start with '='.  I can't complete on =mailbox either,
for the same reason.

Now, this does work:

# mutt -f=mailbox

as does this:

# mutt -f \=mailbox

However, I am accustomed to typing the command as

# mutt -f =mailbox

So here are my questions:

1. How do you get around the fact that the shell grabs the '='?  Can
you turn that off for this one command?

2. Is there a way to write a completion that rewrites the what is
already on the command line?  For instance, if I typed in this:

# mutt -f =mailb<tab>

could the shell expand it to

# mutt -f \=mailbox

or

# mutt -f=mailbox

by changing what had already been typed?

I have perused the manual carefully, and have been unable to develop an
answer.

Thanks,
Phil.

-- 
Phil Hollenback
Engineering Services
The Santa Cruz Operation
831-427-7358


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

end of thread, other threads:[~1999-05-10 11:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-02 12:57 Compctl question Erwin J. van Eijk
1998-02-02 15:58 ` Adam R. Paul
1999-05-07 17:44 compctl question Philip J. Hollenback
1999-05-07 18:02 ` Sweth Chandramouli
1999-05-10 11:15 Sven Wischnowsky

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