3 # This theme needs a terminal supporting 256 colors as well as unicode.
4 # In order to avoid external dependencies, it also has a zsh version of
5 # the previously used perl script https://github.com/trapd00r/utils/blob/master/zsh_path,
6 # which splits up the current path and makes it fancy.
8 # By default it spans over two lines like so:
10 # scp1@shiva:pts/9-> /home » scp1 (0)
13 # that's user@host:pts/-> splitted path (return status)
15 # If the current directory is a git repository, we span 3 lines;
18 # scp1@shiva:pts/4-> /home » scp1 » dev » utils (0)
21 autoload -U add-zsh-hook
25 local c1=$'\e[38;5;245m'
26 local c2=$'\e[38;5;250m'
27 local c3=$'\e[38;5;242m'
28 local c4=$'\e[38;5;197m'
29 local c5=$'\e[38;5;225m'
30 local c6=$'\e[38;5;240m'
31 local c7=$'\e[38;5;242m'
32 local c8=$'\e[38;5;244m'
33 local c9=$'\e[38;5;162m'
35 local c11=$'\e[38;5;208m\e[1m'
36 local c12=$'\e[38;5;142m\e[1m'
37 local c13=$'\e[38;5;196m\e[1m'
41 setopt localoptions nopromptsubst
44 colors=$(echoti colors)
48 1 '%F{228}' 2 '%F{222}' 3 '%F{192}' 4 '%F{186}'
49 5 '%F{227}' 6 '%F{221}' 7 '%F{191}' 8 '%F{185}'
50 9 '%F{226}' 10 '%F{220}' 11 '%F{190}' 12 '%F{184}'
51 13 '%F{214}' 14 '%F{178}' 15 '%F{208}' 16 '%F{172}'
52 17 '%F{202}' 18 '%F{166}'
56 for dir (${(s:/:)PWD}); do
57 if [[ $i -eq 1 ]]; then
58 if [[ $colors -ge 256 ]]; then
59 print -Pn "%F{065}%B /%b"
61 print -Pn "\e[31;1m /"
64 if [[ $colors -ge 256 ]]; then
65 print -Pn "${yellow[$i]:-%f} » "
67 print -Pn "%F{yellow} > "
73 if [[ $colors -ge 256 ]]; then
74 print -Pn "%F{065}$dir"
76 print -Pn "%F{blue}$dir"
83 # We don't want to use the extended colorset in the TTY / VC.
84 if [ "$TERM" = linux ]; then
99 zstyle ':vcs_info:*' actionformats \
100 '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
102 zstyle ':vcs_info:*' formats \
103 "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f "
105 zstyle ':vcs_info:*' enable git
107 add-zsh-hook precmd prompt_jnrowe_precmd
109 prompt_jnrowe_precmd () {
111 if [ "${vcs_info_msg_0_}" = "" ]; then
112 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
113 PROMPT='${dir_status} ${ret_status}%{$reset_color%}
115 # modified, to be committed
116 elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
117 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
118 PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
119 ${dir_status}%{$reset_color%}
121 elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
122 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
123 PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
124 ${dir_status}%{$reset_color%}
127 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
128 PROMPT='${vcs_info_msg_0_}
129 ${dir_status}%{$reset_color%}