commit aadafb6e7cac915e5c9eccdbb17faf7d5815f535 parent b11492ff3ec7f0d3b006140ae45b05d66167f32d Author: Chris Bracken <chris@bracken.jp> Date: Sun, 7 Jun 2026 08:05:50 +0900 zsh: move zcompdump under XDG_CACHE_HOME This isn't config so doesn't belong in the default $ZDOTDIR/.zcompdump location. Diffstat:
| M | .config/zsh/.zshrc | | | 19 | +++++++++++-------- |
| M | .gitignore | | | 4 | ---- |
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc @@ -29,21 +29,24 @@ zstyle ':compinstall' filename "$ZDOTDIR/.zshrc" # Use menu-style autocompletion. zstyle ':completion:*' menu select -# Initialize completion for current session. +# Initialize completion for current session. The dump is regenerable cache, so +# it lives under XDG_CACHE_HOME alongside zsh_histfile. +zcompdump="$XDG_CACHE_HOME/zsh/zcompdump" autoload -Uz compinit -if [[ -n $ZDOTDIR/.zcompdump(#qNmh-24) ]]; then - # .zcompinit generated within the last 24 hours. +if [[ -n $zcompdump(#qNmh-24) ]]; then + # zcompdump regenerated within the last 24 hours. # Skip the `compaudit` check to speed things up. - compinit -C + compinit -C -d "$zcompdump" else - compinit + compinit -d "$zcompdump" fi -# Compile .zcompdump to bytecode so subsequent shells load it via mmap instead +# Compile zcompdump to bytecode so subsequent shells load it via mmap instead # of re-parsing the text dump. -if [[ -s $ZDOTDIR/.zcompdump && (! -s $ZDOTDIR/.zcompdump.zwc || $ZDOTDIR/.zcompdump -nt $ZDOTDIR/.zcompdump.zwc) ]]; then - zcompile -R -- $ZDOTDIR/.zcompdump.zwc $ZDOTDIR/.zcompdump +if [[ -s $zcompdump && (! -s ${zcompdump}.zwc || $zcompdump -nt ${zcompdump}.zwc) ]]; then + zcompile -R -- ${zcompdump}.zwc $zcompdump fi +unset zcompdump # Current VCS branch (for prompt). vcs_branch() { diff --git a/.gitignore b/.gitignore @@ -51,10 +51,6 @@ .config/nvim/*.sug # zsh cached data. -.config/zsh/.zcompdump -.config/zsh/.zcompdump.zwc -.config/zsh/.zcompdumps/ -.config/zsh/.zsh_history .config/zsh/.zsh_sessions/ # jj cached data.