diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-11-07 22:38:02 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-11-07 22:38:02 +0100 |
commit | fed0fd249ef9d2c2a21bb5dfb98ce53b12040354 (patch) | |
tree | 0c2582a660a6f8406e85a1b93380f2ec78f39147 /config/essentials/zsh | |
parent | 5ad22dddaf672552cba44932f8d33860456907df (diff) |
added completion system configuration
Diffstat (limited to 'config/essentials/zsh')
-rw-r--r-- | config/essentials/zsh/.zshrc | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 76ff87f..45f98e4 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -15,13 +15,61 @@ autoload -U select-word-style autoload -z edit-command-line zle -N edit-command-line zstyle ':compinstall' filename '/home/aluc/.zshrc' + +### Completion +# cache +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" + +# completers +zstyle ':completion:*' completer _extensions _complete _approximate + +# format +zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}!- (%e) -!%f' +zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D%d --%f' +zstyle ':completion:*:*:*:*:messages' format '%F{purple}-- %d --%f' +zstyle ':completion:*:*:*:*:warnings' format '%F{red}-- no matches found --%f' +zstyle ':completion:*:default' list-prompt '%S%M matches%s' +# show a 'ls -a' like outptut when listing files +zstyle ':completion:*' file-list all +zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS} + +# Group completions by categories +zstyle ':completion:*' group-name '' +zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands + +zstyle ':completion:*' squeeze-slashes true + +# Prefer completing for an option (think cd -) +zstyle ':completion:*' complete-options true + +# See ZSHCOMPWID "completion matching control" +zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + +# keep prefix when completing +zstyle ':completion:*' keep-prefix true + +# ui zstyle ':completion:*' menu select -autoload -Uz compinit +# Move around using h j k l in completion menu +zmodload zsh/complist +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect '^xg' clear-screen +# interactive mode +bindkey -M menuselect '^xi' vi-insert +bindkey -M menuselect '^xh' accept-and-hold # Hold +bindkey -M menuselect '^xn' accept-and-infer-next-history # Next +bindkey -M menuselect '^xu' undo # Undo + +autoload -Uz compinit; compinit + autoload -Uz surround zle -N delete-surround surround zle -N add-surround surround zle -N change-surround surround -compinit # Source files . $ZDOTDIR/functions.zsh |