Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 3.0.x completion on commands w/ common prefix
- X-seq: zsh-users 3500
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Phil Pennock <Phil.Pennock@xxxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxx
- Subject: Re: 3.0.x completion on commands w/ common prefix
- Date: Wed, 1 Nov 2000 11:04:36 -0800
- In-reply-to: <20001101120532.A67952@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <20001101120532.A67952@xxxxxxxxxxxx>
On Nov 1, 12:05pm, Phil Pennock wrote:
> Subject: 3.0.x completion on commands w/ common prefix
> I have a whole bunch of commands which all start with a common prefix.
> I'd like to set a standard tab-completion for any command starting with
> that prefix, no matter where in $PATH they are.
>
> The specifics:
> * array $sshhosts with list of hostnames
> * commands all start remote_
You want something along the lines of
compctl -Tx 'W[0,remote_*] p[1,-1]' -k sshhosts
Which says that if the word in command position matches the pattern
"remote_*" and you are completing in any of the argument positions, then
use the array sshhosts. Otherwise (part of the definition of -T, but
see below) fall through to normal completion for the command.
You can change the range specified with p[] to change where sshhosts is
used, add other extended-completion patterns, etc. Note that you get only
one compctl -T, so if you have other commands that you want to pattern-
match in this way, you have to add more `W[0,...]' alternatives to the -x
set, e.g.
compctl -Tx 'W[0,remote_*] p[1,-1]' -k sshhosts \
- 'W[0,x*] c[-1,-display]' -k x11displays
and so on.
In 3.1.9 (and at some point after 3.1.5, but I forget exactly when) you
need to append `-tn' to the end of the compctl to specify the fallthrough
behavior (the default changed).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author