diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2020-01-02 15:46:19 -0500 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2020-01-02 15:46:19 -0500 |
commit | ff9208623b3573c736ae9118947aaf0c7e752998 (patch) | |
tree | 45977b00446155003d486c04c3b891a5b7c88441 /plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | |
parent | 1456610ebd292625fdc34fa3167c9c0f67d85228 (diff) | |
parent | ca627655dbd1d110dbea34ec4a8c1964a1da83d2 (diff) | |
download | zsh-ff9208623b3573c736ae9118947aaf0c7e752998.tar.gz zsh-ff9208623b3573c736ae9118947aaf0c7e752998.tar.bz2 zsh-ff9208623b3573c736ae9118947aaf0c7e752998.zip |
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh')
-rw-r--r-- | plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 2a4b43189..b07b2a306 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -77,6 +77,12 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then else ENV_NAME="" fi + + if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then + # We've just left the repo, deactivate the environment + # Note: this only happens if the virtualenv was activated automatically + deactivate && unset CD_VIRTUAL_ENV + fi if [[ "$ENV_NAME" != "" ]]; then # Activate the environment only if it is not already active if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then @@ -86,10 +92,6 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME" fi fi - elif [[ -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then - # We've just left the repo, deactivate the environment - # Note: this only happens if the virtualenv was activated automatically - deactivate && unset CD_VIRTUAL_ENV fi fi } |