changeset 533:22fb4745cb1b

set more completion options in zsh
author Zeger Van de Vannet <zegervdv@me.com>
date Tue, 25 Jan 2022 21:54:03 +0100
parents e932c2076dba
children aee830df7a88
files dot_zshrc
diffstat 1 files changed, 38 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/dot_zshrc	Fri Jan 21 09:33:28 2022 +0100
+++ b/dot_zshrc	Tue Jan 25 21:54:03 2022 +0100
@@ -69,7 +69,16 @@
 bindkey '^p' history-substring-search-up
 bindkey '^n' history-substring-search-down
 
-bindkey '^ ' autosuggest-accept
+bindkey '^f' autosuggest-accept
+
+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
+
+# Enter interactive search
+bindkey -M menuselect '^xi' vi-insert
 
 export LESS_TERMCAP_mb=$(printf "\e[1;31m")
 export LESS_TERMCAP_md=$(printf "\e[1;31m")
@@ -116,44 +125,54 @@
 setopt complete_in_word
 setopt always_to_end
 setopt auto_menu
+setopt auto_param_slash
+
+# Enable completers
+zstyle ':completion:*' completer _complete _approximate
+
+zstyle ':completion:*' use-cache on
+zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
+
+# file list info
+zstyle ':completion:*' file-list list
 
 # activate color-completion
-zstyle ':completion:*:default'         list-colors ${(s.:.)LS_COLORS}
+zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
 
 # format on completion
-zstyle ':completion:*:descriptions'    format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}'
+zstyle ':completion:*:descriptions' format $'%{\e[0;31m%}completing %B%d%b%{\e[0m%}'
 
 # insert all expansions for expand completer
-zstyle ':completion:*:expand:*'        tag-order all-expansions
-zstyle ':completion:*:history-words'   list false
+zstyle ':completion:*:expand:*' tag-order all-expansions
+zstyle ':completion:*:history-words' list false
 
 # activate menu
-zstyle ':completion:*:history-words'   menu yes
+zstyle ':completion:*:history-words' menu yes
 
 # ignore duplicate entries
-zstyle ':completion:*:history-words'   remove-all-dups yes
-zstyle ':completion:*:history-words'   stop yes
+zstyle ':completion:*:history-words' remove-all-dups yes
+zstyle ':completion:*:history-words' stop yes
 
-zstyle ':completion:*:matches'         group 'yes'
-zstyle ':completion:*'                 group-name ''
+zstyle ':completion:*:matches' group 'yes'
+zstyle ':completion:*' group-name ''
 if [[ "$NOMENU" -eq 0 ]] ; then
   # if there are more than 5 options allow selecting from a menu
-  zstyle ':completion:*'               menu select=5
+  zstyle ':completion:*' menu select=5
 else
   # don't use any menus at all
   setopt no_auto_menu
 fi
 
-zstyle ':completion:*:messages'        format '%d'
-zstyle ':completion:*:options'         auto-description '%d'
+zstyle ':completion:*:messages' format '%d'
+zstyle ':completion:*:options' auto-description '%d'
 
 # describe options in full
-zstyle ':completion:*:options'         description 'yes'
+zstyle ':completion:*:options' description 'yes'
 
 # complete manual by their section
-zstyle ':completion:*:manuals'    separate-sections true
-zstyle ':completion:*:manuals.*'  insert-sections   true
-zstyle ':completion:*:man:*'      menu yes select
+zstyle ':completion:*:manuals' separate-sections true
+zstyle ':completion:*:manuals.*' insert-sections   true
+zstyle ':completion:*:man:*' menu yes select
 
 # Search path for sudo completion
 zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
@@ -171,7 +190,8 @@
 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:|=*'
 
 # nvim completion
-zstyle ':completion::*:nvim:*' ignored-patterns '*.(o|hex|elf|pyc|pdf|dup)'
+zstyle ':completion:*:*:nvim:*' ignored-patterns '*.(o|hex|elf|pyc|pdf|dup)'
+zstyle ':completion:*:*:nvim:*' file-sort modification
 
 autoload -U compinit && compinit