zsh: completion: only accept one mistake per 1 characters

This commit is contained in:
Thomas Preisner 2017-07-15 01:50:51 +02:00
parent 9254a6137d
commit 3de8370545

View file

@ -50,17 +50,21 @@ zstyle ':completion:::::' completer \
_force_rehash _expand _complete _prefix _ignored _approximate _force_rehash _expand _complete _prefix _ignored _approximate
#TODO: keep _prefix or not? #TODO: keep _prefix or not?
# ignore case when trying to match typed characters
zstyle ':completion:*:(^approximate):*' matcher-list 'm:{a-z}={A-Z}'
# allow one mistake per three characters
zstyle -e ':completion:*:approximate:*' max-errors \
'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'
# ===== completion appearance # ===== completion appearance
# use ls colors for completion # use ls colors for completion
# Fallback to built in ls colors
#zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
# Make the list prompt friendly # Make the list prompt friendly
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' zstyle ':completion:*:default' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
# Make the selection prompt friendly when there are a lot of choices # Make the selection prompt friendly when there are a lot of choices
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' zstyle ':completion:*:default' select-prompt '%SScrolling active: current selection at %p%s'
# Add simple colors to kill # Add simple colors to kill
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
@ -70,9 +74,6 @@ zstyle ':completion:*' menu select=1 _complete _ignored _approximate
# insert all expansions for expand completer # insert all expansions for expand completer
# zstyle ':completion:*:expand:*' tag-order all-expansions # zstyle ':completion:*:expand:*' tag-order all-expansions
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# offer indexes before parameters in subscripts # offer indexes before parameters in subscripts
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters