virtualenvwrapper plugin fix #112852

when we're not in enabled mode and `DISABLE_VENV_CD=1`:
  - safely delete the chpwd hook `workon_cwd` if it were previously set up

Signed-off-by: Maxim Kovgan <makovgan@redhat.com>
This commit is contained in:
Maxim Kovgan 2024-12-18 09:25:59 +02:00
parent b9e73b4481
commit 1af0fedcf0
1 changed files with 5 additions and 0 deletions

View File

@ -89,4 +89,9 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
autoload -U add-zsh-hook
add-zsh-hook chpwd workon_cwd
[[ $PWD != ~ ]] && workon_cwd
else
if [[ "${chpwd_functions[(Ie)workon_cwd]}" -ne 0 ]]; then
autoload -U add-zsh-hook
add-zsh-hook -d chpwd workon_cwd
fi
fi