zsh: completion: add _force_rehash completer

This commit is contained in:
Thomas Preisner 2017-07-15 01:47:58 +02:00
parent e56aaef60f
commit 9254a6137d

View file

@ -35,6 +35,23 @@ complete-word-or-complete-list-of-files() {
zle -N complete-word-or-complete-list-of-files
bindkey '^I' complete-word-or-complete-list-of-files
# Force a reload of the completion system if nothing matched; this fixes
# installing a program and then trying to tab-completing its name.
_force_rehash() {
if (( CURRENT == 1 )); then
rehash
fi
# we didn't really complete anything.
return 1
}
# list of completers to use
zstyle ':completion:::::' completer \
_force_rehash _expand _complete _prefix _ignored _approximate
#TODO: keep _prefix or not?
# ===== completion appearance
# use ls colors for completion
# Fallback to built in ls colors
#zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}"
@ -48,9 +65,6 @@ zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %
# Add simple colors to kill
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
# list of completers to use
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
zstyle ':completion:*' menu select=1 _complete _ignored _approximate
# insert all expansions for expand completer