From 934576b89b5d34ba6c420c2cf2647af7352a8cea Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 24 Nov 2026 15:54:08 -0800 Subject: [PATCH] feat(init): keep the zcompdump file in `$ZSH_CACHE_DIR` The default dump file moves from `${ZDOTDIR:-$HOME}` to `$ZSH_CACHE_DIR`, so it no longer clutters the home directory. `ZSH_COMPDUMP` still overrides the location, and `omz reload` already deletes the dump wherever it lives. Diagnostics list dump files in both places. The first shell after updating rebuilds the dump once. Old `~/.zcompdump-*` files are left in place and can be deleted. Closes #13406 Co-Authored-By: Monson Shao --- lib/diagnostics.zsh | 7 ++++--- oh-my-zsh.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh index 29929f3fc..ec66384f2 100644 --- a/lib/diagnostics.zsh +++ b/lib/diagnostics.zsh @@ -237,9 +237,10 @@ function _omz_diag_dump_one_big_text() { fi builtin echo builtin echo "Zsh compdump files:" - local dumpfile dumpfiles - command ls -lad $zdotdir/.zcompdump* - dumpfiles=( $zdotdir/.zcompdump*(N) ) + local dumpfile + local -U dumpfiles + dumpfiles=( $zdotdir/.zcompdump*(N) ${ZSH_COMPDUMP:h}/.zcompdump*(N) ) + (( $#dumpfiles )) && command ls -lad $dumpfiles if [[ $verbose -ge 2 ]]; then for dumpfile in $dumpfiles; do _omz_diag_dump_echo_file_w_header $dumpfile diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3c6dbdbd7..bc5c8e197 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -128,7 +128,7 @@ fi # Save the location of the current completion dump file. if [[ -z "$ZSH_COMPDUMP" ]]; then - ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" + ZSH_COMPDUMP="${ZSH_CACHE_DIR}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi # Resolve the commit $ZSH is checked out at into $REPLY by reading the git