feat(zsh): harden completion setup

This commit is contained in:
2026-03-09 13:35:28 +01:00
parent 6582a55df9
commit ed4e8cabe9
3 changed files with 10 additions and 4 deletions

2
.gitignore vendored
View File

@@ -19,9 +19,7 @@ zsh/*
!zsh/.zsh_plugins*.txt !zsh/.zsh_plugins*.txt
!zsh/scripts.zsh !zsh/scripts.zsh
!zsh/aliases.zsh !zsh/aliases.zsh
!zsh/completions/.keep
!zsh/ssh-menu !zsh/ssh-menu
!zsh/get-dump
# starship # starship
!starship !starship

View File

@@ -33,10 +33,18 @@ source "$ZDOTDIR/aliases.zsh"
source "$ZDOTDIR/scripts.zsh" source "$ZDOTDIR/scripts.zsh"
# completion # completion
fpath=("$ZDOTDIR/completions" $fpath) fpath=("$XDG_DATA_HOME/zsh/completions" $fpath)
autoload -Uz compinit autoload -Uz compinit
compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" # only regenerate dump once per day
local _zcompdump="$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION"
if [[ -n $_zcompdump(#qN.mh+24) ]]; then
compinit -d "$_zcompdump"
else
compinit -C -d "$_zcompdump"
fi
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache" zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache"
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
eval "$(starship init zsh)" eval "$(starship init zsh)"
eval "$(direnv hook zsh)" eval "$(direnv hook zsh)"

View File