From 732c7b8070a75ac5ad5384b4d22d19f499e8424f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 10 Feb 2015 12:24:05 +0100 Subject: [PATCH] Simplify adding workon_cwd to chpwd hook --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 0ad336917..5faa1a823 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -64,12 +64,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then # Append workon_cwd to the chpwd_functions array, so it will be called on cd # http://zsh.sourceforge.net/Doc/Release/Functions.html - # TODO: replace with 'add-zsh-hook chpwd workon_cwd' when oh-my-zsh min version is raised above 4.3.4 - if (( ${+chpwd_functions} )); then - if (( $chpwd_functions[(I)workon_cwd] == 0 )); then - set -A chpwd_functions $chpwd_functions workon_cwd - fi - else - set -A chpwd_functions workon_cwd + if ! (( $chpwd_functions[(I)workon_cwd] )); then + chpwd_functions+=(workon_cwd) fi fi