fix(pyenv): preserve shims in login shells
macOS path_helper runs after .zshenv and can move system Python ahead of pyenv. Add an idempotent login hook and preserve it across later easyzsh migrations.
This commit is contained in:
@@ -23,5 +23,11 @@ fi
|
||||
|
||||
# Always-on fragment: ~/.config/zsh/pyenv.zsh (sourced from ~/.zshenv)
|
||||
curl -fsSL https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s -- zsh/pyenv
|
||||
# macOS path_helper runs after ~/.zshenv in login shells, so reapply pyenv afterwards.
|
||||
PYENV_LOGIN_HOOK='[[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh" ]] && . "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/pyenv.zsh"'
|
||||
if ! grep -Fqx "$PYENV_LOGIN_HOOK" "$HOME/.zprofile" 2>/dev/null; then
|
||||
[[ ! -s "$HOME/.zprofile" ]] || printf '\n' >> "$HOME/.zprofile"
|
||||
printf '%s\n' "$PYENV_LOGIN_HOOK" >> "$HOME/.zprofile"
|
||||
fi
|
||||
# Drop legacy interactive-only copy if present
|
||||
rm -f "$HOME/.config/zshrc/pyenv.zsh"
|
||||
|
||||
Reference in New Issue
Block a user