zsh-users
 help / color / mirror / code / Atom feed
From: martin f krafft <madduck@madduck.net>
To: zsh users list <zsh-users@zsh.org>
Subject: Making file-patterns and tag-order work
Date: Tue, 21 Mar 2017 22:49:17 +1300	[thread overview]
Message-ID: <20170321094917.3aopmzwkpaam7kgl@fishbowl.rw.madduck.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 2378 bytes --]

Hello,

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

  zstyle ':completion:*:argument-rest:' file-patterns '
    *(-/):directories:directories
    (*.(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 \
  '((*.(ba#k|old)|*~)|*.(l#[oa]|py[co]|zwc)|*.te#mp|.*.sw?|*(-/))'

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
  directories
    foobar/
  backup files
    foo.bk                     foo.old
  compiled files
    foo.a    foo.la   foo.lo   foo.o    foo.pyc  foo.zwc
  temp files
    foo.tmp
  vim swap files
    .foo.txt.swp
  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 "
    directories
    globbed-files files all-files
    backup-files
    compiled-files
    temp-files
    vim-swap-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@madduck.net

[-- Attachment #2: Digital GPG signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current) --]
[-- Type: application/pgp-signature, Size: 1118 bytes --]

             reply	other threads:[~2017-03-21  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21  9:49 martin f krafft [this message]
2017-03-22  1:15 ` Bart Schaefer
2017-03-22  3:35   ` martin f krafft
2017-03-23  4:13     ` Bart Schaefer
2017-03-24  6:59       ` martin f krafft
2017-03-24  9:19         ` Mikael Magnusson
2017-03-24 10:18           ` martin f krafft
2017-03-24 23:15             ` Bart Schaefer
2017-03-25 11:02               ` martin f krafft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170321094917.3aopmzwkpaam7kgl@fishbowl.rw.madduck.net \
    --to=madduck@madduck.net \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).