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

Re: Get description of the completion



On Oct 13, 12:21am, Joerg wrote:
}
} % grep -h<$MAGIC_KEY>
} -h           -- suppress printing of filenames

What you're effectively asking for is a way to use the knowledge that
is encapsulated in the completion system as the documentation output
by run-help.

I can't think of any good way to do this.  It's sort of antithetical
to the design of the completion system, which is is organized around
finding what's *not* present, often to the point of explicitly excluding
from consideration whatever already is present.  Since "-h" is already on
the line, it (usually) won't be considered as a candidate for completing
again.  So you'd have to note what character was there, backspace over
it, invoke the completion and capture the list of descriptions, then put
the character back, filter for the corresponding description, and call
_message to display it.

"Invoke the completion and capture the list" is difficult at best;
you'd need to copy the tricks used by _complete_help.  What's nearly
impossible is knowing exactly what you need to remove from the line,
in any given context, in order to cause what's on the line when you
begin, to be included as a possible completion (and ideally to be
treated as the *only* possible completion).



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