1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
0 |
+autoload -U add-zsh-hook |
|
1 |
+autoload -Uz vcs_info |
|
2 |
+ |
|
3 |
+zstyle ':vcs_info:*' actionformats \ |
|
4 |
+ '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' |
|
5 |
+zstyle ':vcs_info:*' formats \ |
|
6 |
+ '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f ' |
|
7 |
+zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' |
|
8 |
+zstyle ':vcs_info:*' enable git |
|
9 |
+ |
|
10 |
+add-zsh-hook precmd prompt_jnrowe_precmd |
|
11 |
+ |
|
12 |
+prompt_jnrowe_precmd () { |
|
13 |
+ vcs_info |
|
14 |
+ |
|
15 |
+ if [ "${vcs_info_msg_0_}" = "" ]; then |
|
16 |
+ dir_status="%F{2}→%f" |
|
17 |
+ elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then |
|
18 |
+ dir_status="%F{1}▶%f" |
|
19 |
+ elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then |
|
20 |
+ dir_status="%F{3}▶%f" |
|
21 |
+ else |
|
22 |
+ dir_status="%F{2}▶%f" |
|
23 |
+ fi |
|
24 |
+} |
|
25 |
+ |
|
26 |
+local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)" |
|
27 |
+ |
|
28 |
+PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} ' |
|
29 |
+ |
|
30 |
+# vim: set ft=zsh ts=4 sw=4 et: |