Commit 31f8dee03a25

Vincent Demeester <vincent@sbr.pm>
2026-07-06 23:18:28
feat(zsh): enhance completion with alias expansion and kill colors
Added _expand_alias as first completer, + key in menu select for multi-pick, and colored kill process completion with full command info. Inspired by Vincent Bernat's zshrc.
1 parent b0c8a95
Changed files (1)
dots
config
dots/config/zsh/core/20-completion.zsh
@@ -52,7 +52,7 @@ zstyle ':completion:*' group-name ''
 zstyle ':completion:*' verbose yes
 
 # Fuzzy match mistyped completions
-zstyle ':completion:*' completer _complete _list _match _approximate
+zstyle ':completion:*' completer _expand_alias _complete _list _match _approximate
 zstyle ':completion:*:match:*' original only
 zstyle ':completion:*:approximate:*' max-errors 1 numeric
 zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
@@ -72,6 +72,10 @@ zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directori
 zstyle ':completion:*' squeeze-slashes true
 zstyle ':completion:*' special-dirs true
 
+# Accept current item and stay in menu to pick more (+)
+zmodload -i zsh/complist
+bindkey -M menuselect "+" accept-and-menu-complete
+
 # Environmental variables
 zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
 
@@ -96,6 +100,11 @@ zstyle '*' single-ignored show
 zstyle ':completion:*:(rm|kill|diff):*' ignore-line other
 zstyle ':completion:*:rm:*' file-patterns '*:all-files'
 
+# Kill completion with colored PIDs
+zstyle ':completion:*:processes' command 'ps -eo pid,user,comm,cmd -w -w'
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
+zstyle ':completion:*:kill:*' force-list always
+
 # Man
 zstyle ':completion:*:manuals' separate-sections true
 zstyle ':completion:*:manuals.(^1*)' insert-sections true