5bcfab37312511a7ffc3e8242ba8b8a622ecf061
- Author
- Jonathan Tron <jonathan@tron.name>
- Committer
- Jonathan Tron <jonathan@tron.name>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme
2new file mode 100644
3index 0000000000000000000000000000000000000000..add485279cfcc0df29817e1cabc8b8224e9948af
4--- /dev/null
5+++ b/themes/jonathan.zsh-theme
6@@ -0,0 +1,137 @@
7+function precmd {
8+ local TERMWIDTH
9+ (( TERMWIDTH = ${COLUMNS} - 1 ))
10+
11+
12+ ###
13+ # Truncate the path if it's too long.
14+
15+ PR_FILLBAR=""
16+ PR_PWDLEN=""
17+
18+ local promptsize=${#${(%):---(%n@%m:%l)---()--}}
19+ local rubyprompt=`rvm_prompt_info`
20+ local rubypromptsize=${#${rubyprompt}}
21+ local pwdsize=${#${(%):-%~}}
22+
23+ if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
24+ ((PR_PWDLEN=$TERMWIDTH - $promptsize))
25+ else
26+ PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}"
27+ fi
28+
29+}
30+
31+
32+setopt extended_glob
33+preexec () {
34+ if [[ "$TERM" == "screen" ]]; then
35+ local CMD=${1[(wr)^(*=*|sudo|-*)]}
36+ echo -n "\ek$CMD\e\\"
37+ fi
38+}
39+
40+
41+setprompt () {
42+ ###
43+ # Need this so the prompt will work.
44+
45+ setopt prompt_subst
46+
47+
48+ ###
49+ # See if we can use colors.
50+
51+ autoload colors zsh/terminfo
52+ if [[ "$terminfo[colors]" -ge 8 ]]; then
53+ colors
54+ fi
55+ for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
56+ eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
57+ eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
58+ (( count = $count + 1 ))
59+ done
60+ PR_NO_COLOUR="%{$terminfo[sgr0]%}"
61+
62+ ###
63+ # Modify Git prompt
64+ ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
65+ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
66+ ZSH_THEME_GIT_PROMPT_DIRTY=""
67+ ZSH_THEME_GIT_PROMPT_CLEAN=""
68+
69+ ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
70+ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
71+ ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
72+ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
73+ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
74+ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
75+
76+ ###
77+ # See if we can use extended characters to look nicer.
78+
79+ typeset -A altchar
80+ set -A altchar ${(s..)terminfo[acsc]}
81+ PR_SET_CHARSET="%{$terminfo[enacs]%}"
82+ PR_SHIFT_IN="%{$terminfo[smacs]%}"
83+ PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
84+ PR_HBAR=${altchar[q]:--}
85+ PR_ULCORNER=${altchar[l]:--}
86+ PR_LLCORNER=${altchar[m]:--}
87+ PR_LRCORNER=${altchar[j]:--}
88+ PR_URCORNER=${altchar[k]:--}
89+
90+
91+ ###
92+ # Decide if we need to set titlebar text.
93+
94+ case $TERM in
95+ xterm*)
96+ PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
97+ ;;
98+ screen)
99+ PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
100+ ;;
101+ *)
102+ PR_TITLEBAR=''
103+ ;;
104+ esac
105+