0d897cca7499a4dd46536acbd999723fd0ca2b5d

Author
Gravemind <gravemind2a@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Fix hyphen and underscore filename completion

This deletes the previous hack that allowed completing files with
the extension: e.g. `abcd.z` to `abcdefg.z`.

It is still possible to use `abcd[TAB].z`, and hyphens or underscores
are very much more important than this other trick.

Source:
https://github.com/robbyrussell/oh-my-zsh/issues/1398#issuecomment-169163149

Signed-off-by: Marc Cornellà <marc.cornella@live.com>

Diff

 1diff --git a/lib/completion.zsh b/lib/completion.zsh
 2index f5b29247127543f4aec6ffec6bdb4b29bcdd9de1..85c892165d8c72df43474397d6189fdbae6a9961 100644
 3--- a/lib/completion.zsh
 4+++ b/lib/completion.zsh
 5@@ -12,14 +12,14 @@ zmodload -i zsh/complist
 6 
 7 ## case-insensitive (all),partial-word and then substring completion
 8 if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
 9-  zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
10+  zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
11   unset CASE_SENSITIVE
12 else
13   if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
14-    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
15+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
16     unset HYPHEN_INSENSITIVE
17   else
18-    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
19+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
20   fi
21 fi
22