From: Simon Ruderich Date: Sat, 13 Mar 2010 17:20:29 +0000 (+0100) Subject: zsh/rc: Also simulate chpwd_functions for older Zsh. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=220f80fde532d38202c4cc1bd24b894418160b80;p=config%2Fdotfiles.git zsh/rc: Also simulate chpwd_functions for older Zsh. --- diff --git a/zsh/rc b/zsh/rc index 5029151..303fbe2 100644 --- a/zsh/rc +++ b/zsh/rc @@ -52,7 +52,7 @@ if [[ -d ~/.zsh/functions ]]; then fi # Simulate hooks using _functions arrays for Zsh versions older than 4.3.4. At -# the moment only precmd() and preexec() are simulated. +# the moment only precmd(), preexec() and chpwd() are simulated. # # At least 4.3.4 (not sure about later versions) has an error in add-zsh-hook # so the compatibility version is used there too. @@ -60,7 +60,8 @@ if [[ $ZSH_VERSION != (4.3.<5->|4.<4->*|<5->*) ]]; then # Provide add-zsh-hook which was added in 4.3.4. fpath=(~/.zsh/functions/compatibility $fpath) - # Run all functions defined in the ${precmd,preexec}_functions arrays. + # Run all functions defined in the ${precmd,preexec,chpwd}_functions + # arrays. function precmd() { for function in $precmd_functions; do $function $@ @@ -71,6 +72,11 @@ if [[ $ZSH_VERSION != (4.3.<5->|4.<4->*|<5->*) ]]; then $function $@ done } + function chpwd() { + for function in $chpwd_functions; do + $function $@ + done + } fi # Autoload add-zsh-hook to add/remove zsh hook functions easily.