From 32e4427466adb3d0e2e00b9f6269781e4f6ba5c6 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Wed, 21 Jun 2023 23:27:11 +0300 Subject: [PATCH] Remove current != found venv activation That allows activating non default venvs --- .zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 1643d09..48ac0a5 100644 --- a/.zshrc +++ b/.zshrc @@ -102,7 +102,9 @@ setopt cdable_vars # Enable or disable python virtual env function chpwd_auto_python_venv() { local venv_activation_script=((../)#(.|)(v|)env/bin/activate(#qN.omY1:a)) - if [[ -n "${venv_activation_script}" && ( -z "${VIRTUAL_ENV}" || "${VIRTUAL_ENV}/bin/activate" != "${venv_activation_script}" ) ]]; then + # dont check for (current_venv != found_venv) here because + # we want to support swtiching between venvs + if [[ -n "${venv_activation_script}" && -z "${VIRTUAL_ENV}" ]]; then # we found venv dir that is not yet activated or is different from currently active one source "${venv_activation_script}" elif [[ -z "${venv_activation_script}" && -n "${VIRTUAL_ENV}" ]]; then