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

Re: PATCH: completion for parameter flags



On 3 June 2011 22:54, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> It has not hitherto been possible to complete parameter flags because
> "${(" is not treated as a suitable location for parameter completion,
> so you drop through to ordinary argument-context completion.
>
> It turns out it's quite easy to detect the unbalanaced open parenthesis;
> indeed, the context check for parameters already does, carefully
> remembers the fact, carefully does some more checking, and then
> carefully remembers that all that extra checking was pointless.  I'm not
> sure why it goes to those lengths, but experimentation suggests simply
> noting that we're in a brace parameter and not bothering with the code to
> deal with parameter names gives us enough for the _brace_parameter
> function to pick up on.
>
> So here is some brief C code and an expanded shell function for
> parameter flag completion.

This looks nicer than the hack I posted, but "${(<tab> shows me glob
qualifiers. (Ie, with the leading quotemark). foo${(<tab> does nothing
at all. (---- no match for: `parameter' or `corrections')

-- 
Mikael Magnusson



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