34d3680232232c82c4e3ee850152d127b7317b3c

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #3838 from forivall/hyphen-insensitive

Add hyphen insensitivity

Diff

 1diff --git a/lib/completion.zsh b/lib/completion.zsh
 2index 4b1bb0a6248504714afadf14960831e31f2ef411..452c0dfe765539dd6cf0a83f85037c7ac5f571a9 100644
 3--- a/lib/completion.zsh
 4+++ b/lib/completion.zsh
 5@@ -15,7 +15,12 @@ if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
 6   zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
 7   unset CASE_SENSITIVE
 8 else
 9-  zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
10+  if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
11+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
12+    unset HYPHEN_INSENSITIVE
13+  else
14+    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
15+  fi
16 fi
17 
18 zstyle ':completion:*' list-colors ''
19diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
20index 763288dfd6eab436b7742622f4eb065f3f162f68..44e8b0d1bdf18a17a8b494a2219e54c33fe294ea 100644
21--- a/templates/zshrc.zsh-template
22+++ b/templates/zshrc.zsh-template
23@@ -10,6 +10,10 @@ ZSH_THEME="robbyrussell"
24 # Uncomment the following line to use case-sensitive completion.
25 # CASE_SENSITIVE="true"
26 
27+# Uncomment the following line to use hyphen-insensitive completion. Case
28+# sensitive completion must be off. _ and - will be interchangeable.
29+# HYPHEN_INSENSITIVE="true"
30+
31 # Uncomment the following line to disable bi-weekly auto-update checks.
32 # DISABLE_AUTO_UPDATE="true"
33