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

Re: Tab expansion of {*

On Dec 1,  4:14pm, Dave Yost wrote:
} Z% ls /usr/{*
} Zsh should expand this to
} Z% ls /usr/{X11R6,bin,include,lib,libexec,local,man,sbin,share,standalone}

I'll assume you're referring to compsys-driven expansion rather than to
what happens with only "zsh -f".

This is tricky because by the time the _expand completer is called,
something else has removed the open brace and the pattern appears to
be "/usr/*".  So there's no way for _expand to know that when it adds
the all-expansions completion, it should join with a comma instead of
with a space.

In fact the open brace appears to have been removed by the C code even
before _main_complete is called.  _expand constructs the pattern from
and the brace isn't in there.  There doesn't appear to be anything in
the compstate hash that would reveal that the brace used to be present,
either.  So the only approach seems to be to examine $words[CURRENT],
which feels icky to me.

And even if we got it right that way, I think the internals would end
up adding a comma as the final word separator rather than a brace.  Which
is not necessarily wrong, as brace patterns aren't required to match
real existing file names.

Peter, any thoughts?

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