diff --git a/zsh/completion.zsh b/zsh/completion.zsh index d9569cc..cb6539b 100644 --- a/zsh/completion.zsh +++ b/zsh/completion.zsh @@ -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