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

38 lines
1.2 KiB
Bash
Raw Normal View History

2016-04-16 16:31:54 +02:00
2021-01-20 14:10:03 +01:00
declare -U fpath
2016-04-16 16:31:54 +02:00
2020-06-02 15:59:14 +02:00
fpath=($fpath $ZDOTDIR/completions/)
2021-01-20 14:10:03 +01:00
fpath=($fpath /usr/local/share/zsh/site-functions)
fpath=($fpath $(brew --prefix)/share/zsh/site-functions)
2016-04-16 16:31:54 +02:00
2021-01-20 14:10:03 +01:00
# case insensitive path-completion
2016-04-16 16:31:54 +02:00
2021-01-20 14:10:03 +01:00
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:|=*'
2016-04-16 16:31:54 +02:00
2021-01-20 14:10:03 +01:00
# show descriptions when autocompleting
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' format 'Completing %d'
2016-04-16 16:31:54 +02:00
2021-01-20 14:10:03 +01:00
# partial completion suggestions
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' expand prefix suffix
# list with colors
zstyle ':completion:*' list-colors ''x
2016-04-16 16:31:54 +02:00
# 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
2021-01-20 14:10:03 +01:00
# load completion
autoload -Uz compinit && compinit