1 # Name: trapd00r zsh theme
2 # Author: Magnus Woldrich <m@japh.se>
4 # This theme needs a terminal supporting 256 colors as well as unicode. It also
5 # needs the script that splits up the current path and makes it fancy as located
6 # here: https://github.com/trapd00r/utils/blob/master/zsh_path
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
24 local c0=$( printf "\e[m")
25 local c1=$( printf "\e[38;5;245m")
26 local c2=$( printf "\e[38;5;250m")
27 local c3=$( printf "\e[38;5;242m")
28 local c4=$( printf "\e[38;5;197m")
29 local c5=$( printf "\e[38;5;225m")
30 local c6=$( printf "\e[38;5;240m")
31 local c7=$( printf "\e[38;5;242m")
32 local c8=$( printf "\e[38;5;244m")
33 local c9=$( printf "\e[38;5;162m")
34 local c10=$(printf "\e[1m")
35 local c11=$(printf "\e[38;5;208m\e[1m")
36 local c12=$(printf "\e[38;5;142m\e[1m")
37 local c13=$(printf "\e[38;5;196m\e[1m")
40 # We dont want to use the extended colorset in the TTY / VC.
41 if [ "$TERM" = "linux" ]; then
42 c1=$( printf "\e[34;1m")
43 c2=$( printf "\e[35m")
44 c3=$( printf "\e[31m")
45 c4=$( printf "\e[31;1m")
46 c5=$( printf "\e[32m")
47 c6=$( printf "\e[32;1m")
48 c7=$( printf "\e[33m")
49 c8=$( printf "\e[33;1m")
50 c9=$( printf "\e[34m")
52 c11=$(printf "\e[35;1m")
53 c12=$(printf "\e[36m")
54 c13=$(printf "\e[31;1m")
57 zstyle ':vcs_info:*' actionformats \
58 '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
60 zstyle ':vcs_info:*' formats \
61 "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f "
63 zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
64 zstyle ':vcs_info:*' enable git
66 add-zsh-hook precmd prompt_jnrowe_precmd
68 prompt_jnrowe_precmd () {
70 if [ "${vcs_info_msg_0_}" = "" ]; then
71 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
72 PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
75 # modified, to be commited
76 elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
77 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
78 PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
79 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
82 elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
83 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
84 PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
85 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
88 dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
89 PROMPT='${vcs_info_msg_0_}
90 %{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
95 # vim: set ft=zsh sw=2 et tw=0: