3704fbb71eb4d886aff11cdaff79a1a23a895cd6

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

Message

Extract CWD notifier back out of auto-title hooks

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index 58c6203a0663374c1af46a0cafb4a05fcde1db8b..e1c2e2f93a3b376a02180d21cdddf01f0bcdcb29 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -31,13 +31,6 @@ function omz_termsupport_precmd {
 6   fi
 7 
 8   title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
 9-
10-  # Notify Terminal.app of current directory using undocumented OSC sequence
11-  # found in OS X 10.9 and 10.10's /etc/bashrc
12-  if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
13-    local PWD_URL="file://$HOSTNAME${PWD// /%20}"
14-    printf '\e]7;%s\a' "$PWD_URL"
15-  fi
16 }
17 
18 # Runs before executing the command
19@@ -58,3 +51,16 @@ function omz_termsupport_preexec {
20 
21 precmd_functions+=(omz_termsupport_precmd)
22 preexec_functions+=(omz_termsupport_preexec)
23+
24+
25+# Runs before showing the prompt, to update the current directory in Terminal.app
26+function omz_termsupport_cwd {
27+  # Notify Terminal.app of current directory using undocumented OSC sequence
28+  # found in OS X 10.9 and 10.10's /etc/bashrc
29+  if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
30+    local PWD_URL="file://$HOSTNAME${PWD// /%20}"
31+    printf '\e]7;%s\a' "$PWD_URL"
32+  fi
33+}
34+
35+precmd_functions+=(omz_termsupport_cwd)