From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2682 invoked by alias); 7 Jun 2014 15:12:27 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18875 Received: (qmail 4555 invoked from network); 7 Jun 2014 15:12:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: "nicolas.canceill" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Case-insensitive completion with partial substring matching Message-Id: <33086926-C7D7-4D33-AF86-4B0D48977555@laposte.net> Date: Sat, 7 Jun 2014 17:12:19 +0200 To: zsh-users@zsh.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) X-Mailer: Apple Mail (2.1878.2) 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}=3D{A-Za-z}' 'r:|[._-]=3D* = r:|=3D*' 'l:|=3D* r:|=3D*' 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