1
0
mirror of https://github.com/artizirk/dotfiles.git synced 2024-11-22 00:10:59 +02:00

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

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