dotfiles/.config/zsh/lib/20-completion.zsh

38 lines
1.2 KiB
Bash

declare -U fpath
fpath=($fpath $ZDOTDIR/completions/)
fpath=($fpath /usr/local/share/zsh/site-functions)
fpath=($fpath /opt/homebrew/share/zsh/site-functions)
# case insensitive path-completion
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
# show descriptions when autocompleting
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' format 'Completing %d'
# partial completion suggestions
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' expand prefix suffix
# list with colors
zstyle ':completion:*' list-colors ''x
# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
cdpath=(.)
if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
expand-or-complete-with-dots() {
echo -n "\e[31m......\e[0m"
zle expand-or-complete
zle redisplay
}
zle -N expand-or-complete-with-dots
bindkey "^I" expand-or-complete-with-dots
fi
# load completion
autoload -Uz compinit && compinit