Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 44 lines (33 sloc) 1.144 kb
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
1 grey='\e[0;90m'
2
3 ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}("
4 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
5 ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}"
6 ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})"
7
1582570 @joshprice Made the user_machine_size calculation generic. Pwned the function name.
joshprice authored
8 function josh_prompt {
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
9 (( spare_width = ${COLUMNS} ))
10 prompt=" "
11
12 branch=$(current_branch)
6496acf @sbfaulkner adding rbenv support to all the rvm themes
sbfaulkner authored
13 ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
14 path_size=${#PWD}
15 branch_size=${#branch}
16 ruby_size=${#ruby_version}
1582570 @joshprice Made the user_machine_size calculation generic. Pwned the function name.
joshprice authored
17 user_machine_size=${#${(%):-%n@%m-}}
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
18
19 if [[ ${#branch} -eq 0 ]]
20 then (( ruby_size = ruby_size + 1 ))
21 else
22 (( branch_size = branch_size + 4 ))
23 if [[ -n $(git status -s 2> /dev/null) ]]; then
24 (( branch_size = branch_size + 2 ))
25 fi
26 fi
27
1582570 @joshprice Made the user_machine_size calculation generic. Pwned the function name.
joshprice authored
28 (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) ))
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
29
30 while [ ${#prompt} -lt $spare_width ]; do
31 prompt=" $prompt"
32 done
33
ce6a21c @solnic [themes/josh] Use $(current_branch) in prompt
solnic authored
34 prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)"
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
35
36 echo $prompt
37 }
38
39 setopt prompt_subst
40
41 PROMPT='
1582570 @joshprice Made the user_machine_size calculation generic. Pwned the function name.
joshprice authored
42 %n@%m $(josh_prompt)
eb14ee1 @joshprice Added my own theme based on pat's
joshprice authored
43 %(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} '
Something went wrong with that request. Please try again.