Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Trouble using file-patterns to group filetypes in completion
- X-seq: zsh-workers 29612
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Trouble using file-patterns to group filetypes in completion
- Date: Tue, 26 Jul 2011 09:19:37 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=7I5nU817bkOHtWGMROnNQPZ0/QLY+xBWDE8xNXnXI3Q=; b=VTxUVAy+cGLvmwmbJ8VY2vbKzKgTMD/442/8Utwdzl6b0lDOGMRfT+SwBT2SsYzgws swRv4tjkYQCYOLAzKNnWGZB5BoLmMaRyycMwKnG0KbGKvpT50LeNjwqJxGpu/1Ly2jMV nQMobORGYguFtGYrTPrUQGwtRCfYHt4FWv77c=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hi,
I wanted to make source files complete before other files when using
vim (for example), so I tried
zstyle ':completion:*' file-patterns '*(-/):directories
*.(c|cpp|cxx|C):source-files:source\ file
^*.(c|cpp|cxx|C):other-files:other\ file'
but it only seems to work with commands that don't specify a pattern
to _files, contrary to what the manpage says.
% edit <tab>
---- file
evmouse* joylauncher* joymouse* joywheel* usbkeypad*
evmouse.c joylauncher.c joymouse.c joywheel.c usbkeypad.c
% ls <tab>
---- source file
evmouse.c joylauncher.c joymouse.c joywheel.c usbkeypad.c
---- other file
evmouse* joylauncher* joymouse* joywheel* usbkeypad*
It would additionally be nice to not have to specify the pattern twice
to avoid this effect,
% ls <tab>
---- source file
evmouse.c joylauncher.c joymouse.c joywheel.c
usbkeypad.c
---- other file
evmouse* joylauncher* joymouse* joywheel* usbkeypad*
evmouse.c joylauncher.c joymouse.c joywheel.c usbkeypad.c
which you get with
zstyle ':completion:*' file-patterns '*(-/):directories
*.(c|cpp|cxx|C):source-files:source\ file *:other-file:other\ file'
Note that I don't want to use
zstyle ':completion:*' file-patterns '*(-/):directories
*.(c|cpp|cxx|C):source-files:source\ file' '*:other-file:other\ file'
as this results in
% ls <tab>
---- source file
evmouse.c joylauncher.c joymouse.c joywheel.c usbkeypad.c
with no other files listed at all. Weirdly, this seems to work for vim
too, it now only lists .c files, but under just a "--- file" header
rather than "--- source file". Does it somehow override the tags I set
in file-patterns resulting in them not being grouped separately?
If I change '(-t)*:file:_vim_files' to '(-t)*: :_vim_files' in _vim, I
get this...
---- source file
---- other file
evmouse* joylauncher* joymouse* joywheel* usbkeypad*
evmouse.c joylauncher.c joymouse.c joywheel.c usbkeypad.c
which looks like
zstyle ':completion:*' group-name ''
being ignored.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author