Skip to content
Newer
Older
100644 29 lines (23 sloc) 954 Bytes
b11e289 @agnoster Add agnoster.zsh-theme
agnoster authored Sep 13, 2012
1 # Theme by [agnoster](https://github.com/agnoster)
2 # See https://gist.github.com/3712874
3
4 ZSH_THEME_GIT_PROMPT_DIRTY='±'
5
6 function _git_prompt_info() {
7 ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
8 echo "${ref/refs\/heads\//⭠ }$(parse_git_dirty)"
9 }
10
11 function _git_info() {
12 if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
13 local BG_COLOR=green
14 if [[ -n $(parse_git_dirty) ]]; then
15 BG_COLOR=yellow
16 fi
17 echo "%{%K{$BG_COLOR}%}⮀%{%F{black}%} $(_git_prompt_info) %{%F{$BG_COLOR}%K{blue}%}⮀"
18 else
19 echo "%{%K{blue}%}⮀"
20 fi
21 }
22
23 PROMPT_HOST='%{%b%F{gray}%K{black}%} %(?.%{%F{green}%}✔.%{%F{red}%}✘)%{%F{gray}%} %m %{%F{black}%}'
24 PROMPT_DIR='%{%F{white}%} %1~ '
25 PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}⮀%{%F{yellow}%} ⚡ %{%k%F{black}%}.%{%k%F{blue}%})⮀%{%f%k%b%}'
26
27 PROMPT='%{%f%b%k%}
28 $PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU '
Something went wrong with that request. Please try again.