5f79ab5547f51bd32dcd0a1b21fc26c8720711ba

Author
Andrew Janke <janke@pobox.com>
Committer
Andrew Janke <janke@pobox.com>
Date

Message

Move chpwd update output from chpwd hook to precmd to avoid
contaminating script/function output

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index d9f2b64d4548006e901e850560268892b2d1eec6..ce36f229f201505c14b4ae3d738f226f2976fcc4 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -16,12 +16,19 @@ function title {
 6 ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
 7 ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
 8 
 9-#Appears when you have the prompt
10+# Runs when you have the prompt
11 function omz_termsupport_precmd {
12   title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
13+
14+  # Notify Terminal.app of current directory using undocumented OSC sequence
15+  # found in OS X 10.9 and 10.10's /etc/bashrc
16+  if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
17+    local PWD_URL="file://$HOSTNAME${PWD// /%20}"
18+    printf '\e]7;%s\a' "$PWD_URL"
19+  fi
20 }
21 
22-#Appears at the beginning of (and during) of command execution
23+# Runs at the beginning of (and during) of command execution
24 function omz_termsupport_preexec {
25   emulate -L zsh
26   setopt extended_glob
27@@ -33,18 +40,5 @@ function omz_termsupport_preexec {
28   title '$CMD' '%100>...>$LINE%<<'
29 }
30 
31-#Appears each time pwd is changed
32-function omz_termsupport_chpwd {
33-  #Notify Terminal.app of current directory using undocumented OSC sequence
34-  #found in OS X 10.10's /etc/bashrc
35-  if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
36-    local PWD_URL="file://$HOSTNAME${PWD// /%20}"
37-    printf '\e]7;%s\a' "$PWD_URL"
38-  fi
39-}
40-#Fire it once so the pwd is set properly upon shell startup
41-omz_termsupport_chpwd
42-
43 precmd_functions+=(omz_termsupport_precmd)
44 preexec_functions+=(omz_termsupport_preexec)
45-chpwd_functions+=(omz_termsupport_chpwd)