Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: invoking compadd so that completion is for the second argument
- X-seq: zsh-users 14204
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: invoking compadd so that completion is for the second argument
- Date: Wed, 24 Jun 2009 09:47:42 +0100
- In-reply-to: <20090623201701.GO4907@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090623201701.GO4907@xxxxxxxxxxxxx>
Eric Smith wrote:
> So the command:
> % prefix_cp sour<tab>
> will just complete as per the default rules, but
>
> % prefix_cp source_file.pdf <tab>
> should give me:
> % prefix_cp source_file.pdf aa_code_reference_00034
> assuming this was the first match in the list
You want something like:
#compdef prefix_cp
if (( CURRENT == 2 )); then
_default
else
local expl
local -a array
array=(special1 special2)
_wanted special expl 'special value' compadd -a array
fi
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author