Diff
1diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme
2index 92f1df941e7c0f027b78df4b86ebeeb7db4b82b3..275341dc67a8d85caafe92d78ab414787f104cdc 100644
3--- a/themes/apple.zsh-theme
4+++ b/themes/apple.zsh-theme
5@@ -2,7 +2,7 @@ function toon {
6 echo -n ""
7 }
8
9-get_git_dirty() {
10+get_git_dirty() {
11 git diff --quiet || echo '*'
12 }
13
14@@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \
15 zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
16 zstyle ':vcs_info:*' enable git cvs svn
17
18-precmd () {
19+theme_precmd () {
20 vcs_info
21 }
22
23 setopt prompt_subst
24 PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
25+
26+autoload -U add-zsh-hook
27+add-zsh-hook precmd theme_precmd
28diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
29index add485279cfcc0df29817e1cabc8b8224e9948af..a170a13d0b435e835244c1cb945dbf07f4474beb 100644
30--- a/themes/jonathan.zsh-theme
31+++ b/themes/jonathan.zsh-theme
32@@ -1,19 +1,19 @@
33-function precmd {
34+function theme_precmd {
35 local TERMWIDTH
36 (( TERMWIDTH = ${COLUMNS} - 1 ))
37
38
39 ###
40 # Truncate the path if it's too long.
41-
42+
43 PR_FILLBAR=""
44 PR_PWDLEN=""
45-
46+
47 local promptsize=${#${(%):---(%n@%m:%l)---()--}}
48 local rubyprompt=`rvm_prompt_info`
49 local rubypromptsize=${#${rubyprompt}}
50 local pwdsize=${#${(%):-%~}}
51-
52+
53 if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
54 ((PR_PWDLEN=$TERMWIDTH - $promptsize))
55 else
56@@ -24,7 +24,7 @@ function precmd {
57
58
59 setopt extended_glob
60-preexec () {
61+theme_preexec () {
62 if [[ "$TERM" == "screen" ]]; then
63 local CMD=${1[(wr)^(*=*|sudo|-*)]}
64 echo -n "\ek$CMD\e\\"
65@@ -69,7 +69,7 @@ setprompt () {
66
67 ###
68 # See if we can use extended characters to look nicer.
69-
70+
71 typeset -A altchar
72 set -A altchar ${(s..)terminfo[acsc]}
73 PR_SET_CHARSET="%{$terminfo[enacs]%}"
74@@ -81,10 +81,10 @@ setprompt () {
75 PR_LRCORNER=${altchar[j]:--}
76 PR_URCORNER=${altchar[k]:--}
77
78-
79+
80 ###
81 # Decide if we need to set titlebar text.
82-
83+
84 case $TERM in
85 xterm*)
86 PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
87@@ -96,8 +96,8 @@ setprompt () {
88 PR_TITLEBAR=''
89 ;;
90 esac
91-
92-
93+
94+
95 ###
96 # Decide whether to set a screen title
97 if [[ "$TERM" == "screen" ]]; then
98@@ -105,8 +105,8 @@ setprompt () {
99 else
100 PR_STITLE=''
101 fi
102-
103-
104+
105+
106 ###
107 # Finally, the prompt.
108
109@@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
110 }
111
112 setprompt
113+
114+autoload -U add-zsh-hook
115+add-zsh-hook precmd theme_precmd
116+add-zsh-hook preexec theme_preexec
117diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme
118index 6e04e1595aa4d0d0dfc96f1961bfb756252ed9f4..e743289c35aff6561f519b4702c5b070df08320a 100644
119--- a/themes/kolo.zsh-theme
120+++ b/themes/kolo.zsh-theme
121@@ -7,7 +7,7 @@ zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
122 zstyle ':vcs_info:*' check-for-changes true
123 zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
124 zstyle ':vcs_info:*' enable git svn
125-precmd () {
126+theme_precmd () {
127 if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
128 zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
129 } else {
130@@ -19,3 +19,6 @@ precmd () {
131
132 setopt prompt_subst
133 PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
134+
135+autoload -U add-zsh-hook
136+add-zsh-hook precmd theme_precmd