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

Re: invoking compadd so that completion is for the second argument



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