f9de64460ce51e105f27d30a9ecb20612ab65d57
- Author
- Alexander Simonov <devil@zeus.(none)>
- Committer
- Alexander Simonov <alex@simonov.me>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme
2new file mode 100644
3index 0000000000000000000000000000000000000000..01f381c48b3059c19bcfed3b0b41611dcb0247bc
4--- /dev/null
5+++ b/themes/simonoff.zsh-theme
6@@ -0,0 +1,142 @@
7+# Prompt
8+#
9+# Below are the color init strings for the basic file types. A color init
10+# string consists of one or more of the following numeric codes:
11+# Attribute codes:
12+# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
13+# Text color codes:
14+# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
15+# Background color codes:
16+# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
17+function precmd {
18+
19+ local TERMWIDTH
20+ (( TERMWIDTH = ${COLUMNS} - 1 ))
21+
22+
23+ ###
24+ # Truncate the path if it's too long.
25+
26+ PR_FILLBAR=""
27+ PR_PWDLEN=""
28+
29+ local promptsize=${#${(%):---(%n@%M:%l)---()}}
30+ local pwdsize=${#${(%):-%~}}
31+ local gitbranch="$(git_prompt_info)"
32+ local rvmprompt="$(rvm_prompt_info)"
33+ local gitbranchsize=${#${gitbranch:-''}}
34+ local rvmpromptsize=${#${rvmprompt:-''}}
35+
36+ if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then
37+ ((PR_PWDLEN=$TERMWIDTH - $promptsize))
38+ else
39+ PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}"
40+ fi
41+}
42+
43+
44+setopt extended_glob
45+
46+preexec () {
47+ if [[ "$TERM" == "screen" ]]; then
48+ local CMD=${1[(wr)^(*=*|sudo|-*)]}
49+ echo -n "\ek$CMD\e\\"
50+ fi
51+
52+ if [[ "$TERM" == "xterm" ]]; then
53+ print -Pn "\e]0;$1\a"
54+ fi
55+
56+ if [[ "$TERM" == "rxvt" ]]; then
57+ print -Pn "\e]0;$1\a"
58+ fi
59+
60+}
61+
62+setprompt () {
63+###
64+# Need this so the prompt will work.
65+
66+ setopt prompt_subst
67+
68+
69+###
70+# See if we can use colors.
71+
72+ autoload colors zsh/terminfo
73+ if [[ "$terminfo[colors]" -ge 8 ]]; then
74+ colors
75+ fi
76+ for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
77+ eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
78+ eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
79+ (( count = $count + 1 ))
80+ done
81+ PR_NO_COLOUR="%{$terminfo[sgr0]%}"
82+
83+
84+###
85+# See if we can use extended characters to look nicer.
86+
87+ typeset -A altchar
88+# set -A altchar "${(s..)terminfo[acsc]}"
89+ PR_SET_CHARSET="%{$terminfo[enacs]%}"
90+ PR_HBAR=${altchar[q]:--}
91+ PR_ULCORNER=${altchar[l]:--}
92+ PR_LLCORNER=${altchar[m]:--}
93+ PR_LRCORNER=${altchar[j]:--}
94+ PR_URCORNER=${altchar[k]:--}
95+
96+ ###
97+ # Modify Git prompt
98+ ZSH_THEME_GIT_PROMPT_PREFIX=" ["
99+ ZSH_THEME_GIT_PROMPT_SUFFIX="]"
100+ ###
101+ # Modify RVM prompt
102+ ZSH_THEME_RVM_PROMPT_PREFIX=" ["
103+ ZSH_THEME_RVM_PROMPT_SUFFIX="]"
104+ ZSH_THEME_RVM_PROMPT_OPTIONS=(v i)
105+