summaryrefslogtreecommitdiff
path: root/themes/jonathan.zsh-theme
diff options
context:
space:
mode:
authorChristian Höltje <docwhat@gerf.org>2011-11-15 01:20:29 -0500
committerChristian Höltje <docwhat@gerf.org>2011-11-15 01:20:29 -0500
commit5277a0ffaacbc2e23c8753fefdf1c4fe6d1e7685 (patch)
treee2a9bfa1705ef0960a70aa951c4ef040a14f4621 /themes/jonathan.zsh-theme
parent40c47a737571468b759bbc30e4b4dc4b5f77470f (diff)
downloadzsh-5277a0ffaacbc2e23c8753fefdf1c4fe6d1e7685.tar.gz
zsh-5277a0ffaacbc2e23c8753fefdf1c4fe6d1e7685.tar.bz2
zsh-5277a0ffaacbc2e23c8753fefdf1c4fe6d1e7685.zip
Added add-zsh-hook support to themes
I added add-zsh-hook support to the themes that didn't have it already. This allows the themes to co-exist with plugins and lib/termsupport.
Diffstat (limited to 'themes/jonathan.zsh-theme')
-rw-r--r--themes/jonathan.zsh-theme28
1 files changed, 16 insertions, 12 deletions
diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
index add485279..a170a13d0 100644
--- a/themes/jonathan.zsh-theme
+++ b/themes/jonathan.zsh-theme
@@ -1,19 +1,19 @@
-function precmd {
+function theme_precmd {
local TERMWIDTH
(( TERMWIDTH = ${COLUMNS} - 1 ))
###
# Truncate the path if it's too long.
-
+
PR_FILLBAR=""
PR_PWDLEN=""
-
+
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
local rubyprompt=`rvm_prompt_info`
local rubypromptsize=${#${rubyprompt}}
local pwdsize=${#${(%):-%~}}
-
+
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
((PR_PWDLEN=$TERMWIDTH - $promptsize))
else
@@ -24,7 +24,7 @@ function precmd {
setopt extended_glob
-preexec () {
+theme_preexec () {
if [[ "$TERM" == "screen" ]]; then
local CMD=${1[(wr)^(*=*|sudo|-*)]}
echo -n "\ek$CMD\e\\"
@@ -69,7 +69,7 @@ setprompt () {
###
# See if we can use extended characters to look nicer.
-
+
typeset -A altchar
set -A altchar ${(s..)terminfo[acsc]}
PR_SET_CHARSET="%{$terminfo[enacs]%}"
@@ -81,10 +81,10 @@ setprompt () {
PR_LRCORNER=${altchar[j]:--}
PR_URCORNER=${altchar[k]:--}
-
+
###
# Decide if we need to set titlebar text.
-
+
case $TERM in
xterm*)
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
@@ -96,8 +96,8 @@ setprompt () {
PR_TITLEBAR=''
;;
esac
-
-
+
+
###
# Decide whether to set a screen title
if [[ "$TERM" == "screen" ]]; then
@@ -105,8 +105,8 @@ setprompt () {
else
PR_STITLE=''
fi
-
-
+
+
###
# Finally, the prompt.
@@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
}
setprompt
+
+autoload -U add-zsh-hook
+add-zsh-hook precmd theme_precmd
+add-zsh-hook preexec theme_preexec \ No newline at end of file