zsh: completion: add _force_rehash completer
This commit is contained in:
parent
e56aaef60f
commit
9254a6137d
1 changed files with 17 additions and 3 deletions
|
|
@ -35,6 +35,23 @@ complete-word-or-complete-list-of-files() {
|
||||||
zle -N 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
|
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
|
# Fallback to built in ls colors
|
||||||
#zstyle ':completion:*' list-colors ''
|
#zstyle ':completion:*' list-colors ''
|
||||||
zstyle ':completion:*' list-colors "${(@s.:.)LS_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
|
# 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'
|
||||||
|
|
||||||
# list of completers to use
|
|
||||||
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate
|
|
||||||
|
|
||||||
zstyle ':completion:*' menu select=1 _complete _ignored _approximate
|
zstyle ':completion:*' menu select=1 _complete _ignored _approximate
|
||||||
|
|
||||||
# insert all expansions for expand completer
|
# insert all expansions for expand completer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue