mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 03:26:42 +00:00
fix(zshrc): clean stale paths from PATH before loading zinit and mise
Remove any stale zinit plugin paths and mise install paths from PATH before loading/activating them. This prevents issues when shell sessions inherit cached environment variables from tools like direnv in VSCode.
This commit is contained in:
9
zshrc
9
zshrc
@@ -58,6 +58,9 @@ fi
|
|||||||
echo &&
|
echo &&
|
||||||
git clone --depth=1 "https://github.com/zdharma-continuum/zinit.git" "${ZINIT[BIN_DIR]}"
|
git clone --depth=1 "https://github.com/zdharma-continuum/zinit.git" "${ZINIT[BIN_DIR]}"
|
||||||
|
|
||||||
|
# Remove any stale Zinit plugin paths before loading to avoid issues.
|
||||||
|
path=("${(@)path:#${ZINIT[HOME_DIR]}/plugins/*}")
|
||||||
|
|
||||||
# Load Zinit
|
# Load Zinit
|
||||||
source "${ZINIT[BIN_DIR]}/zinit.zsh"
|
source "${ZINIT[BIN_DIR]}/zinit.zsh"
|
||||||
|
|
||||||
@@ -265,6 +268,12 @@ if ! command-exists mise; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if command-exists mise; then
|
if command-exists mise; then
|
||||||
|
# Remove any stale mise install paths before activation to ensure it correctly
|
||||||
|
# activates. This ensures any tooling that starts shells with an existing set
|
||||||
|
# of cached env vars will not cause issues. I'm looking at you, direnv for
|
||||||
|
# VSCode.
|
||||||
|
path=("${(@)path:#${MISE_HOME}/installs/*}")
|
||||||
|
|
||||||
# Activate mise. We cannot use cached-eval here as the activation script
|
# Activate mise. We cannot use cached-eval here as the activation script
|
||||||
# dynamically adjusts how it modifies PATH on each invocation.
|
# dynamically adjusts how it modifies PATH on each invocation.
|
||||||
eval "$("$MISE_INSTALL_PATH" activate zsh)"
|
eval "$("$MISE_INSTALL_PATH" activate zsh)"
|
||||||
|
|||||||
Reference in New Issue
Block a user