Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Changing subword-range according to current completion context
On Fri, Nov 03 2017, Peter Stephenson wrote:
>> I'd like to fine-tune the way words are interpreted according to the
>> completion context which was used to expand the word, not to the zle
>> context.
>>
>> Is it saved anywhere? Is it possible to correlate the two?
>
> Hmm, I'm not sure that completion even has a generic notion of
> words as such. Each completion just parses the command line, generally
> (but not necessarily) starting with a single command line word as
> entered so far --- in this case parsed according to shell rules by
> the lexical analyser, this is hard-wired because it's extremely
> complicated --- and then takes it from there. I can't think of a point
> where it matches neatly onto a single interface that tells you the bits
> of what you're looking at.
Isn't the state of each word, once expanded, saved somewhere?
_complete_debug doesn't show anything interested.
By reading the manual, I'm not completely sure about the relationship
between match-words-by-style and match-word-context.
> Did you have an example?
Just to reiterate, imagine expanding a path. But the expansion needs to
be altered for some reason. I often kill the last path component.
If the context of the completer was saved, I could say that *only*
expanded paths get splitted by '/', and not other arguments.
I'm not sure it would be "terrific" in practical terms, as for this kind
of interaction you need to play around and see if it's worth the
tweaking.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author