zsh-users
 help / color / mirror / code / Atom feed
* Case-insensitive completion with partial substring matching
@ 2014-06-07 15:12 nicolas.canceill
  2014-06-07 17:54 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: nicolas.canceill @ 2014-06-07 15:12 UTC (permalink / raw)
  To: zsh-users

Hi every one,

I was looking for a way to enable case-insensitive completion with partial substring matching, and it seems many people are using this:

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'

However, people at Oh-My-Zsh found it triggers an interesting "bug" [1]. To be clear, it is not related to OMZ (at least, no further than the fact that OMZ also uses that line). I call it a "bug", but it is just an undesirable side-effect of the matcher-list statement, and I want to understand how to fix it.

How to reproduce?
The "bug" occurs when a completion is triggered with multiple choices such that:
* completion choices are all the same length;
* completion choices share a common suffix;
* that suffix is at least half of the length but not the full length;
* in each choice, the first and the n-th character of the suffix are both letters, where n is the length of the prefix;
* in each choice, the character just before the common suffix is a digit (maybe it works with other character types but i did not find any), and that character is different for each choice.

Under the above conditions, the "bug" occurs when completing after a substring prefixing the common suffix (i.e. completing after "a" or "ab" or "abc", when the common suffix is "abc") will insert a letter before the suffix. This letter will be the n-th character of the suffix, in inverted case.

Example: in a directory containing two files "1abc" and "2abc", completing after "less a" will expand it to "abc" and then add an extra "A", so the command line will look like "less Aabc".

I am still struggling to understand the depth of Zsh's completion system, so please, can anyone help me understand why the above behavior happens? Especially why does it specifically happen with digits?

Just pointing me in the right direction will be greatly appreciated. Best regards.

Nicolas Canceill

[1] https://github.com/robbyrussell/oh-my-zsh/issues/2030


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-07 21:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-07 15:12 Case-insensitive completion with partial substring matching nicolas.canceill
2014-06-07 17:54 ` Bart Schaefer
2014-06-07 18:00   ` nicolas.canceill
2014-06-07 19:30     ` Bart Schaefer
2014-06-07 20:39       ` nicolas.canceill
2014-06-07 21:02         ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).