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

compctl question



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



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