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

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



Thanks Bart

Bart Schaefer said:
> For example, given a command line such as:
> 
> % roger dodger codger
> 
> Do you mean:
> 
> (1) The completion for "roger" is invoked, but the set of matches for
>     "codger" is not the same as the set of matches for "dodger"; or

Something like this, indeed.

I create commands that allow me to copy or move existing files to
special named files.  The prefix of these special names I want
to look up from a list in a file referenced by compadd.

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

<parenthesis>
Oh I just had an idea for the first time now writing this.
If I went:
% prefix_cp source_file.pdf aa_code_reference_00034_<tab>
It would be great to have as the completion the first arg viz.
!#1 or `source_file.pdf'

But this is a bonus.

</parenthesis>

Thanks a lot.

Eric



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