====== compsys: Matchers ======
==== Approximate ====
Fuzzy matching of completions for when you mistype them:
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
And if you want the number of errors allowed by _approximate to increase with the length of what you have typed so far:
zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
==== Using _expand before _complete ====
I use the _expand completer before _complete in my main completer but it is nice to have _match and _all_matches available on other key bindings:
zstyle ':completion:all-matches::::' completer _all_matches _complete
zstyle ':completion:all-matches:*' old-matches true
zstyle ':completion:all-matches:*' insert true
zstyle ':completion:match-word::::' completer _all_matches _match _ignored
zstyle ':completion:match-word:*' insert-unambiguous true
zstyle ':completion:match-word:*' match-original both
zle -C all-matches complete-word _generic
zle -C match-word complete-word _generic
bindkey '^Xx' all-matches
bindkey '\e*' match-word