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

Re: PATCH 3/5: _imagemagick: complete all files if image files didn't match



On Fri, Aug 14, 2015 at 10:44 AM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> Bart wrote:
>> As I think I've mentioned elsewhere, file-patterns seems to take
>> precedence over list-dirst-first anyway.  So I suppose it could be
>> interpreted as a shorthand, except for the other-files business.
>
> Yes, it is harmless enough as a shorthand.
[...]
>> Does it ever make sense to use  _files -g '*(/)' ?  Or should -/ always
>> be used in that case?
>
> In that exact example, -/ should be used but there's definitely
> use-cases for globs matching only some directories. For example, to
> select a git repository you might want *(e:[[ -d \$REPLY/.git ]]:)

I think Bart just meant (/) vs (-/), but I'm not sure.

> We don't tend to bother in the functions because the directories get
> picked up for the directories tag anyway and there's no way to tell the
> selected directories apart from those only there because they might be
> part of the path to the final directory. You can't use complist colours
> because that works on the basis of the group rather than the tag. If you
> use separate groups then you get matches duplicated.
>
> Instead of *(-/) for the directories, we ideally need to negate the glob
> specified with -g. The trouble is that it is actually quite hard to get
> the opposite of a glob. The opposite of *.ext(ab,cd) is something like
> ^*.ext *.ext(^a,^b)(^c,^d)
> It'd probably be easier to expand the glob in an array and use that
> array as a filter. I'd be interested if anyone has any ideas on how to
> do this.

Something like this?
all=(*) positive=(*.ext(ab,cd))
negative=( ${all:|positive} )

You can't actually write that in a glob:tag part though... (And doing
it in (e:...:) would be very slow)

[...]

-- 
Mikael Magnusson



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