fa78fd456cddc752c5c11808b0a220d65d330d9c

Author
Marc Cornellà <marc.cornella@live.com>
Committer
GitHub <noreply@github.com>
Date

Message

Merge pull request #5435 from mcornella/fix-completion-hyphened-files

Fix completion of files with hyphens and underscores

Diff

 1diff --git a/lib/completion.zsh b/lib/completion.zsh
 2index f5b29247127543f4aec6ffec6bdb4b29bcdd9de1..bbd02165659dec1032d8f6ef98f0c276e6ab9677 100644
 3--- a/lib/completion.zsh
 4+++ b/lib/completion.zsh
 5@@ -1,4 +1,7 @@
 6 # fixme - the load process here seems a bit bizarre
 7+zmodload -i zsh/complist
 8+
 9+WORDCHARS=''
10 
11 unsetopt menu_complete   # do not autoselect the first completion entry
12 unsetopt flowcontrol
13@@ -6,32 +9,26 @@ setopt auto_menu         # show completion menu on succesive tab press
14 setopt complete_in_word
15 setopt always_to_end
16 
17-WORDCHARS=''
18-
19-zmodload -i zsh/complist
20+# should this be in keybindings?
21+bindkey -M menuselect '^o' accept-and-infer-next-history
22+zstyle ':completion:*:*:*:*:*' menu select
23 
24-## case-insensitive (all),partial-word and then substring completion
25-if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
26-  zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
27-  unset CASE_SENSITIVE
28+# case insensitive (all), partial-word and substring completion
29+if [[ "$CASE_SENSITIVE" = true ]]; then
30+  zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
31 else
32-  if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
33-    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
34-    unset HYPHEN_INSENSITIVE
35+  if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
36+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
37   else
38-    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
39+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
40   fi
41 fi
42+unset CASE_SENSITIVE HYPHEN_INSENSITIVE
43 
44 zstyle ':completion:*' list-colors ''
45-
46-# should this be in keybindings?
47-bindkey -M menuselect '^o' accept-and-infer-next-history
48-
49-zstyle ':completion:*:*:*:*:*' menu select
50 zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
51-if [ "$OSTYPE[0,7]" = "solaris" ]
52-then
53+
54+if [[ "$OSTYPE" = solaris* ]]; then
55   zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
56 else
57   zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"