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

Re: completing files first



> Are you using menu-completion? I do, and use this which works well for me:
>
> zstyle ':completion:*' file-patterns '*(-/):directories
> %p(^-/):globbed-files' '*:all-files'
> zstyle ':completion:*' group-order globbed-files all-files directories

Yes I use setopt menucomplete

Your example works sometimes. It works with "cat <TAB>" -- I get two
separate groups named "file", the first one with files, the second with
directories. Great!

But if I try with "less <TAB>" I get only one group "file", with files
and directories in a (alphasorted) mix. Likewise it doesn't work on my
own completer "_myview" (see below).

I tried, to no avail, adding some colons and asterices to your zstyle,
hoping to somehow make it more general. Is it somehow possible?


~/.zsh/completion/_myview:

local extns

extns="(bmp|gif|jp([eg]|eg)|png|p[pngb]m|tif(|f)|tga|x[pb]m|asf|asx|avi|flv|m4v|mkv|mov|mpeg|mpg|vob|ts|qt|rm|we
bm|wmv|pdf|ps|epub|mobi|html|htm|rar|zip|tar(|.(gz|bz|bz2|Z|lzo|lz|xz))|cb(r|z))|doc"

_arguments \
  "*:myviewable documents:_files -g '*.(#i)($extns)(-.)'"




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