zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Leonardo Barbosa <barbosa.leonardo@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: custom completion for listing *.tex is not working
Date: Tue, 10 Sep 2013 08:08:52 -0700	[thread overview]
Message-ID: <130910080852.ZM9661@torch.brasslantern.com> (raw)
In-Reply-To: <CAMXWGTyaZ+YR6pZG8=BLThjNhjZtO1kzW03fRHv3EMeaNk=_ug@mail.gmail.com>

On Sep 9,  8:49am, Leonardo Barbosa wrote:
}
} zstyle ':completion:*:*:vi:*' file-patterns '*.tex:TeX-files' '%p:all-files'
} 
} However, by doing so, it only through TeX files.

Yes, note from the example in the manual "if there is no matching file":

     For example, to make the rm command first complete only names of
     object files and then the names of all files if there is no
     matching object file

What the manual doesn't make clear is that file-patterns may have its
values combined in sets the same way tag-order might.  So start by
removing a couple of quotes:

zstyle ':completion:*:*:vi:*' file-patterns '*.tex:TeX-files %p:all-files'

Next you need to tell completion that even though all those tags are to
be combined into a single listing, you still want the files separated
into groups within the listing:

zstyle ':completion:*:*:vi:*' group-name ''

(The empty string here is a shorthand for "automatically use the tag
names as the group names, so I don't have to repeat all of that.")

This will get you the TeX-files group first, followed by the all-files
group, all within one listing that you can tab through.

} An just one more question, how can i make zsh to highlight the
} selected file in the menu while cycling through files?

Assuming you want this everywhere and not just for vi:

zstyle ':completion:*' menu select=2

This will enter highlighted selection if there are 2 or more matches.
Selection normally starts on the second press of tab (which has nothing
to do with select=2); add "yes=1" if you want it to start immediately
on the first tab.  There are a whole lot of other details controlled
 with the menu style; you might want "yes=long" instead, or a value
larger than select=2, etc.


  reply	other threads:[~2013-09-10 15:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 11:11 Leonardo Barbosa
2013-09-03 14:32 ` Bart Schaefer
2013-09-09 11:49   ` Leonardo Barbosa
2013-09-10 15:08     ` Bart Schaefer [this message]
2013-09-10 16:31       ` Peter Stephenson
2013-09-10 16:45         ` Bart Schaefer
2013-09-06 13:24 ` zzapper

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=130910080852.ZM9661@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=barbosa.leonardo@gmail.com \
    --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).