Currently I have this in my ~/.zshrc:
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
AFAIU 'm:{a-z}={A-Za-z}' means that I will get case-insensitive tab completion, e.g. foo will tab-complete to Foobar (if that exists). And 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' means that I will get matches for later parts of a word, e.g. bar will tab-complete to foobar (if that exists). But those partial matches are not case-insensitive. So for example bar will not tab-complete to FooBar (again, in case that exists).
Is there a way to get that working?
The lists of matchers (each string containing one or more matchers) in your matcher-list are always tried one at a time, until one of them returns at least one match. By default, each list of matchers completely replaces the previous one. To instead make the next matcher list include the previous one, you need to prefix it with a +:
zstyle ':completion:*' matcher-list \
'm:{[:lower:]}={[:upper:]}' \
'+r:|[._-]=* r:|=*' \
'+l:|=*'
See the matcher-list completion style doc.
And
'r:|[._-]=* r:|=*' 'l:|=* r:|=*'means that I will get matches for later parts of a word, e.g.barwill tab-complete tofoobar(if that exists).
Not exactly:
<word> is the string on the command line that’s being completed, then,
<word>*,
— except when COMPLETE_IN_WORD is set, which case it will create a completion pattern by inserting the * at the cursor position instead.r:|<pattern>=* means “In <word>,
: and |)r) by something matching <pattern>,* in the completion pattern between the two.”[._-] is a pattern that matches a single instance of ., _ or -.r:|=* (without anything to the right of |) means
<word> ends on the right with an empty string (which is always true),* in that position in the completion pattern.”l:|=* (without anything to the left of |) means
<word> starts on the left with an empty string (always true),* in that position in the completion pattern.”See the completion matching control docs for a more in-depth explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With