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>
This commit is contained in:
Marc Cornellà 2024-07-13 18:22:06 +02:00
parent fa583cfb87
commit 11ca9e2ac7
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -65,7 +65,7 @@ fi
# Create cache and completions dir and add to $fpath # Create cache and completions dir and add to $fpath
mkdir -p "$ZSH_CACHE_DIR/completions" mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) (( ${fpath[(ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# Check for updates on initial load... # Check for updates on initial load...
source "$ZSH/tools/check_for_upgrade.sh" source "$ZSH/tools/check_for_upgrade.sh"