From 0b3ba4fd4c63bec74483fbb1067e35c9d3ecb361 Mon Sep 17 00:00:00 2001 From: Rick Hansen Date: Wed, 3 May 2017 21:17:17 +1000 Subject: [PATCH] Prevent duplicate hooks in termsupport.zsh when reloading config --- lib/termsupport.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 871ab28d..e51b427e 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -75,8 +75,9 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -precmd_functions+=(omz_termsupport_precmd) -preexec_functions+=(omz_termsupport_preexec) +autoload -U add-zsh-hook +add-zsh-hook precmd omz_termsupport_precmd +add-zsh-hook preexec omz_termsupport_preexec # Keep Apple Terminal.app's current working directory updated @@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then } # Use a precmd hook instead of a chpwd hook to avoid contaminating output - precmd_functions+=(update_terminalapp_cwd) + add-zsh-hook precmd update_terminalapp_cwd # Run once to get initial cwd set update_terminalapp_cwd fi