[TMUX/ZSH] Venv improvements
This commit is contained in:
+23
@@ -176,3 +176,26 @@ zstyle :bracketed-paste-magic paste-finish pastefinish
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)
|
||||
export PATH=$PATH:/Users/ising/.runai/bin
|
||||
source <(/Users/ising/.runai/bin/runai --quiet completion zsh)
|
||||
|
||||
# Re-activate an inherited virtualenv — MUST be the last PATH-affecting line.
|
||||
#
|
||||
# When VIRTUAL_ENV is present in the environment (a tmux pane split carries it
|
||||
# in via `-e VIRTUAL_ENV=...`, see .tmux.conf) we source the venv's activate
|
||||
# script here rather than in .virtual_env_config.zsh. activate snapshots the
|
||||
# current PATH into _OLD_VIRTUAL_PATH and restores it on `deactivate`; if we
|
||||
# activated earlier (before .mac_config.zsh, go, runai below all prepend to
|
||||
# PATH) that snapshot would be incomplete and `deactivate` would strip
|
||||
# ~/.local/bin & friends — dropping claude and co. off PATH. Keeping this last
|
||||
# guarantees the snapshot is the fully-built PATH.
|
||||
#
|
||||
# ANY new PATH mutation must go ABOVE this block.
|
||||
#
|
||||
# A new tmux window clears the var to empty (`bind c ... -e VIRTUAL_ENV=`) to
|
||||
# force the base environment; drop that empty value so nothing sees a bogus venv.
|
||||
[ -z "${VIRTUAL_ENV:-}" ] && unset VIRTUAL_ENV
|
||||
if [ -n "$VIRTUAL_ENV" ] && [ -f "$VIRTUAL_ENV/bin/activate" ]; then
|
||||
# Guard against double-activation on a manual `source ~/.zshrc`.
|
||||
if [[ ":$PATH:" != *":$VIRTUAL_ENV/bin:"* ]]; then
|
||||
source "$VIRTUAL_ENV/bin/activate"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user