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

Re: completion problem with dirs



On Tue, 22 Sep 2009 07:20:48 +0100
David Woodfall <dave@xxxxxxxxxxxxxxx> wrote:
> I have a some completions like:
> 
> zstyle ':completion:*:*:display:*' file-patterns
> '(*.png|*.gif|*.jpg|*.jpeg|*.bmp|*.svg|*.xpm)' file-sort time

That should be:

zstyle ':completion:*:*:display:*' file-patterns \
  '(*.png|*.gif|*.jpg|*.jpeg|*.bmp|*.svg|*.xpm)'
zstyle ':completion:*:*:display:*' file-sort time

However, display is handled by the standard completion _imagemagick:  it
maybe that that needs updating (unless you're specifically trying to
exclude certain types).

> The problem is when I try to follow a directory like:
>
> display ~/some/path/
>
> tabbing does not work for the path completion at all. What do I need
> to add to my completion line to get this to work?

Read further in the documentation for file-patterns and there's enough
information to work it out:

zstyle ':completion:*:*:display:*' file-patterns \
       '(*.png|*.gif|*.jpg|*.jpeg|*.bmp|*.svg|*.xpm)' \
       '*(-/):directories:directory'

What doesn't seem to work, however, is that the documentation suggests that
this should make "directory" be used as the description when completing
directories instead of "picture file", but it doesn't.  It seems to be
being overridden by _imagemagick, which calls

  _files "$@" -g "*.(#i)(${~formats//:/|})(-.)"

for a set of formats defined just above, so fixing that might be a better
bet.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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