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

Making file-patterns and tag-order work


I would like completion to differentiate files according to some
globs. To this end, I've configured:

  zstyle ':completion:*:argument-rest:' file-patterns '
    (*.(ba#k|old)|*~):backup-files:"backup files"
    *.(l#[oa]|py[co]|zwc):compiled-files:"compiled files"
    *.te#mp:temp-files:"temp files"
    .*.sw?:vim-swap-files:"vim swap files"
    %p:globbed-files *:all-files

and also went on to hide all these patterns from the catch-alls in
the last line (is there a way to do this without duplication?):

  zstyle ':completion:*:argument-rest:(all|globbed)-files' ignored-patterns \

The relevant options in effect are:
  auto_list no_list_ambiguous auto_menu no_menu_complete
  no_bash_auto_list list_packed

and if I now try completion, I can confirm that these tags seem to
work (indentation added for clarity):

  fishbowl:/tmp/cdt.6kIDed% cat ^D
  backup files
    foo.bk                     foo.old
  compiled files
    foo.a    foo.la   foo.lo   foo.o    foo.pyc  foo.zwc
  temp files
  vim swap files
    foobar/      foo.c        foo.txt      g

(you can get the directory contents like this:
  touch foo.a foobar foo.bk foo.c foo.la foo.lo foo.o foo.old \
  foo.pyc foo.tmp foo.txt foo.zwc g .foo.txt.swp

I then went on to try to order the tags, because I want e.g. the
swap files to appear last:

  zstyle ':completion:*:argument*' tag-order "
    globbed-files files all-files

Unfortunately, this does not work yet, and there are two problems:

1. the directories show up under 'files'. Is this because
   directories are special (they could contain files), or am I doing
   something wrong?

2. There is no change in the ordering. I've tried group-order too,
   but no effect. What am I missing?

Thanks for any inputs!

@martinkrafft | http://madduck.net/ | http://two.sentenc.es/
"the only difference between the saint and the sinner
 is that every saint has a past and every sinner has a future."
                                                      -- oscar wilde
spamtraps: madduck.bogus@xxxxxxxxxxx

Attachment: digital_signature_gpg.asc
Description: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

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