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

Controlling the order of -/g produced files and directories



Greetings,

I'd like to make such a completion for my utgz and vtgz shell
functions that it matches to *.tgz, *.tar.gz and directories.

My first attempt was as follows:

compctl -g '*.(tgz|tar.gz)' + -g '*(/)' utgz vtgz

This has the problem that the latter pattern is not considered
if the first matches. From completion examples I found "-/g"
option and decided to try it. That is,
compctl -/g '*.(tgz|tar.gz)' utgz vtgz

Although I didn't find explanation for this -/g option in the
documentation, this version seems to work. However, I would
prefer that if some directory has both matching files and
subdirectories then those files would be first in the list of
completions and those directories last. How should this be done?

TIA,
//Hannu



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