linefeed
linefeed copied to clipboard
Support lowercase matched auto completion
First, thank you for your really cool project : )
The doc of Completer::complete
says:
Returns the set of possible completions for the prefix word.
As I understand, it only support prefix based auto completion. However, if auto competion support lowercase matched candidates would be more cool.
Suppose we have subcommands below:
-
count
-
checkout
-
branch
If we type ou
, the matched candidates will be count
and checkout
.
Prefix matching is only the convention. You can implement a Completer
that returns completion candidates based on any arbitrary criteria.
Wow! It actually works!
I tried this before, just not realized it works that way. If the word
is not a prefix
then it just disappeared, the candidates shows up correctly though. Not the way zsh
(or maybe oh-my-zsh
) auto completion works.
Well, linefeed
does expect that the completion candidates will have a common prefix (though it does not require this to be true). The current word is replaced with that prefix. How does zsh
do it when there's no common prefix?
These are candidates of git ou
@TheWaWaR: Wow, that is elaborate. I don't envision linefeed
natively implementing a completion function that looks like that, but if one wanted to implement a similar completion interface as a Command
trait implementation, I believe it would be possible.