forked from zimfw/gitster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitster.zsh-theme
36 lines (28 loc) · 903 Bytes
/
gitster.zsh-theme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# vim:et sts=2 sw=2 ft=zsh
#
# Gitster theme without dependencies
setopt nopromptbang prompt{cr,percent,sp,subst}
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git cvs svn hg
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '%F{green}●%f '
zstyle ':vcs_info:*' unstagedstr '%F{red}●%f '
zstyle ':vcs_info:git*' formats '%F{2}%b%F{3} %F{1}%u%c'
zstyle ':vcs_info:git*' actionformats '%F{2}%b%F{3} [%a] %F{1}%u%c'
precmd() { vcs_info }
vcs_info_wrapper() {
if [ -n "$vcs_info_msg_0_" ]; then
echo "${vcs_info_msg_0_}"
fi
}
_prompt_gitster_pwd() {
local git_root current_dir
if git_root=$(command git rev-parse --show-toplevel 2>/dev/null); then
current_dir="${PWD#${git_root:h}/}"
else
current_dir=${(%):-%~}
fi
print -n "%F{white}${current_dir}"
}
PS1='%(?:%F{green}:%F{red})➜ $(_prompt_gitster_pwd) $(vcs_info_wrapper)%f'
unset RPS1