732c7b8070a75ac5ad5384b4d22d19f499e8424f

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Simplify adding workon_cwd to chpwd hook

Diff

 1diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
 2index 0ad33691743d993b5cdee7b8b0b46528e6afb31f..5faa1a823aa7c9764aef2eb95aed5fa16a5e3bb4 100644
 3--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
 4+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
 5@@ -64,12 +64,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
 6 
 7   # Append workon_cwd to the chpwd_functions array, so it will be called on cd
 8   # http://zsh.sourceforge.net/Doc/Release/Functions.html
 9-  # TODO: replace with 'add-zsh-hook chpwd workon_cwd' when oh-my-zsh min version is raised above 4.3.4
10-  if (( ${+chpwd_functions} )); then
11-    if (( $chpwd_functions[(I)workon_cwd] == 0 )); then
12-      set -A chpwd_functions $chpwd_functions workon_cwd
13-    fi
14-  else
15-    set -A chpwd_functions workon_cwd
16+  if ! (( $chpwd_functions[(I)workon_cwd] )); then
17+    chpwd_functions+=(workon_cwd)
18   fi
19 fi