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

Re: completion but extra options allowed



On Feb 10,  3:34pm, Eric Smith wrote:
} Subject: completion but extra options allowed
}
} Is it possible to allow these options and then any other option in the
} same rule?

Yes, in all sorts of ways.

For mutt specifically, you might try this (taken from Misc/compctl-examples
in 3.0.7 and edited to replace "elm" with "mutt"):

compctl -u -x 's[+] c[-1,-f],s[-f+]' -g '~/Mail/*(:t)' - \
        's[-f],c[-1,-f]' -f -- mutt

This means that you type "mutt -f +<TAB>" and zsh will complete files in
your $HOME/Mail directory following the + sign.  Mutt understands the + as
an abbreviation for the mail directory.  In the absence of a +, zsh just
completes file names after "mutt -f".

In the more general case, you don't have to use -k all by itself; you can
simply add more options to the "compctl" command line and zsh will try
each of them until it finds one that works.  Misc/compctl-examples has a
large number of samples.

Finally, if you're using zsh-3.1.6*, you can get this and more "for free"
by enabling the new completion system.  Look up "compinit" in the manual.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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