b0c9bc88ef630e056bd670ad185514cf435c2085
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Merge pull request #368 from trapd00r/master
add trapd00r theme
Diff
1diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme
2new file mode 100644
3index 0000000000000000000000000000000000000000..cba14c42cab41b9a8f5fc1770b72275a2a273db8
4--- /dev/null
5+++ b/themes/trapd00r.zsh-theme
6@@ -0,0 +1,95 @@
7+# Name: trapd00r zsh theme
8+# Author: Magnus Woldrich <m@japh.se>
9+#
10+# This theme needs a terminal supporting 256 colors as well as unicode. It also
11+# needs the script that splits up the current path and makes it fancy as located
12+# here: https://github.com/trapd00r/utils/blob/master/zsh_path
13+#
14+# By default it spans over two lines like so:
15+#
16+# scp1@shiva:pts/9-> /home » scp1 (0)
17+# >
18+#
19+# that's user@host:pts/-> splitted path (return status)
20+#
21+# If the current directory is a git repository, we span 3 lines;
22+#
23+# git❨ master ❩ DIRTY
24+# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0)
25+# >
26+
27+autoload -U add-zsh-hook
28+autoload -Uz vcs_info
29+
30+local c0=$( printf "\e[m")
31+local c1=$( printf "\e[38;5;245m")
32+local c2=$( printf "\e[38;5;250m")
33+local c3=$( printf "\e[38;5;242m")
34+local c4=$( printf "\e[38;5;197m")
35+local c5=$( printf "\e[38;5;225m")
36+local c6=$( printf "\e[38;5;240m")
37+local c7=$( printf "\e[38;5;242m")
38+local c8=$( printf "\e[38;5;244m")
39+local c9=$( printf "\e[38;5;162m")
40+local c10=$(printf "\e[1m")
41+local c11=$(printf "\e[38;5;208m\e[1m")
42+local c12=$(printf "\e[38;5;142m\e[1m")
43+local c13=$(printf "\e[38;5;196m\e[1m")
44+
45+
46+# We dont want to use the extended colorset in the TTY / VC.
47+if [ "$TERM" = "linux" ]; then
48+ c1=$( printf "\e[34;1m")
49+ c2=$( printf "\e[35m")
50+ c3=$( printf "\e[31m")
51+ c4=$( printf "\e[31;1m")
52+ c5=$( printf "\e[32m")
53+ c6=$( printf "\e[32;1m")
54+ c7=$( printf "\e[33m")
55+ c8=$( printf "\e[33;1m")
56+ c9=$( printf "\e[34m")
57+
58+ c11=$(printf "\e[35;1m")
59+ c12=$(printf "\e[36m")
60+ c13=$(printf "\e[31;1m")
61+fi
62+
63+zstyle ':vcs_info:*' actionformats \
64+ '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
65+
66+zstyle ':vcs_info:*' formats \
67+ "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f "
68+
69+zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
70+zstyle ':vcs_info:*' enable git
71+
72+add-zsh-hook precmd prompt_jnrowe_precmd
73+
74+prompt_jnrowe_precmd () {
75+ vcs_info
76+ if [ "${vcs_info_msg_0_}" = "" ]; then
77+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
78+ PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
79+> '
80+
81+# modified, to be commited
82+ elif [[ $(git diff --cached --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_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
85+%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
86+> '
87+
88+ elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
89+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
90+ PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%}
91+%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%}
92+%{$c13%}>%{$c0%} '
93+ else
94+ dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
95+ PROMPT='${vcs_info_msg_0_}
96+%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
97+> '
98+fi
99+}
100+
101+# vim: set ft=zsh sw=2 et tw=0: