This is needed to play nice with plugins that need various hooks.
Christian HoĢltje authored on 15/11/2011 at 06:14:03... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
#Limited support for Apple Terminal (Terminal can't set window or tab separately) |
5 | 5 |
function title { |
6 | 6 |
[ "$DISABLE_AUTO_TITLE" != "true" ] || return |
7 |
- if [[ "$TERM" == screen* ]]; then |
|
7 |
+ if [[ "$TERM" == screen* ]]; then |
|
8 | 8 |
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars |
9 | 9 |
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then |
10 | 10 |
print -Pn "\e]2;$2:q\a" #set window name |
... | ... |
@@ -16,14 +16,18 @@ ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD |
16 | 16 |
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" |
17 | 17 |
|
18 | 18 |
#Appears when you have the prompt |
19 |
-function precmd { |
|
19 |
+function omz_termsupport_precmd { |
|
20 | 20 |
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE |
21 | 21 |
} |
22 | 22 |
|
23 | 23 |
#Appears at the beginning of (and during) of command execution |
24 |
-function preexec { |
|
24 |
+function omz_termsupport_preexec { |
|
25 | 25 |
emulate -L zsh |
26 | 26 |
setopt extended_glob |
27 | 27 |
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd |
28 | 28 |
title "$CMD" "%100>...>$2%<<" |
29 | 29 |
} |
30 |
+ |
|
31 |
+autoload -U add-zsh-hook |
|
32 |
+add-zsh-hook precmd omz_termsupport_precmd |
|
33 |
+add-zsh-hook preexec omz_termsupport_preexec |