11ca9e2ac7c70b4682e6b7d1e50a1a1cb7c1a5d9

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

fix(init): add cached completions directory only once (#12551)

Double quotes within the subscript test are interpreted literally, making the
test never match. On subsequent runs, the `$ZSH_CACHE_DIR/completions` directory
is always prepended to `$fpath`, even if it is already there. This commit fixes
that.

Fixes #12551

Co-authored-by: Adem Simsek <adem@simsek.dev>

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 694095afae7f192edf18171c59e5a04b6f60b01f..906d19a45bb68c98603212c634de2c323d5c5f5c 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -65,7 +65,7 @@ fi
 6 
 7 # Create cache and completions dir and add to $fpath
 8 mkdir -p "$ZSH_CACHE_DIR/completions"
 9-(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
10+(( ${fpath[(ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
11 
12 # Check for updates on initial load...
13 source "$ZSH/tools/check_for_upgrade.sh"