From 1af0fedcf0b4f26a88c3ef44a85cb35e78a7575a Mon Sep 17 00:00:00 2001 From: Maxim Kovgan Date: Wed, 18 Dec 2024 09:25:59 +0200 Subject: [PATCH] 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 --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 1a3ae37b8..e73e93d88 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -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