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

Re: Adding a prefix to certain filename completions



2005/7/5, Nikolai Weibull <mailing-lists.zsh-users@xxxxxxxxxxxxxxxxxxxxxx>:
...
> I know that the completion system can be made to suit this need.
> Filenames beginning with a = are escaped properly with the right
> settings.
> 

Unfortunately, I'm behind the times, but the following works with the
old completion system.  I'm sure something along the same lines can
done with zstyle and compadd and all that other wackiness.

compctl -f -x 'S[+]' -f -P './' -- vim

That's: for vim, complete filenames, except for arguments starting
with +, for which insert "./" at the beginning and then complete
filenames.  Note that the + already has to be on the command-line; if
you have menu completion on and you type "vim <tab>", filenames
starting with + won't match the above rule and they won't get the ./
prepended.  But "vim +<tab>" does the right thing.



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