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

Re: Skipping certain completers -- how?



Bart Schaefer wrote:

> I have:
> 
> zstyle ':completion:*' completer \
>     _oldlist _expand _complete _match _ignored _approximate _prefix
> 
> I'd like to use only a subset of that list in certain instances, but the
> completer style is looked up with context ':completion:::::' so it's not
> possible to use the context to restrict the list.
> 
> A specific example:  When completing the cvs subcommand name (the first
> word after `cvs' itself) I'd rather that _expand, _ignored, and _prefix
> were NOT called.
> 
> My guess is that this can only be accomplished with a "control function"
> similar to _prefix except operating sort of in reverse -- that is, you
> make that function your only completer, then give the "real" completers
> in a nother style that's looked up by the control function, which then
> calls them.
> 
> We also have the avoid-completer style that could be used to give a list
> of completers to skip in such a control function.
> 
> Can anyone think of anything else that would be involved, or of a better
> way to accomplish this?

There is the -e option to zstyle, of course (and I've added an example
for the `completer' style with it some time ago -- in the Overview
section in compsys.yo).  But I have been thinking about something
similar to what you describe above, too (maybe I even mentioned it here?
maybe not).

The problem is to decide which conditions we should make it be
conditional upon, there are so many things people might want to test.

Btw, I hope to find a way to do the context-check of the completion
system without generating completions one day (so that it can be called
from other widgets). That would then be a good candidate to put into
another pseudo-completer -- a little extra cost gives one a fully
specified context from the beginning (or maybe it should be triggered by
a style in _main_complete). I don't know when (or if) I'll find the time
to try to write that, though.

Bye
  Sven


-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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