Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: custom completion for listing *.tex is not working
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author