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

Re: completion



On Jan 7,  3:00pm, Ray Andrews wrote:
}
} To put it in English, what I'm reaching for (I think), sounds something 
} like this:
} 
} If [something-on-command-line] matches [this-pattern] (a filter), then 
} expand that pattern using [this-particular-set-of-rules], and then 
} search (go find) in [this-particular-group-of-objects] for 
} [this-particular-glob-pattern] and put that on my command line.

Incidentally, no, it's not like that at all.  In fact its so far from
that, that I can't even reword the above to give a better sense of it.
Completion involves several layers of loops-within-loops, it can't be
described in a single if-then sentence.

If you ignore a lot of the looping parts and the listing of ambiguous
matches, then it's sort of like:

Choose a completer and pass it some information about the command line,
from which it will construct a context which summarizes the meaning of
the command line in about six words.  For each/any configuration option
that may be useful, use the context to find the best definition among
the set of zstyle patterns the user has defined.  Some of those options
(called styles) should explain where to look for [this-particular-group-
of-strings], otherwise use a fallback to find them.  Compare whatever
strings you end up with to the word to the left of or under the cursor
and put the longest unambiguous common substring that matches on the
command line, assuming the other styles said that's what you should do.
If there aren't any matches at all, try again with the next completer
until something is found or there are no more completers.



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