Remove current != found venv activation

That allows activating non default venvs
This commit is contained in:
Arti Zirk 2023-06-21 23:27:11 +03:00
parent c9dff2f155
commit 32e4427466
1 changed files with 3 additions and 1 deletions

4
.zshrc
View File

@ -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