agnoster.zsh-theme 954 B

12345678910111213141516171819202122232425262728
  1. # Theme by [agnoster](https://github.com/agnoster)
  2. # See https://gist.github.com/3712874
  3. ZSH_THEME_GIT_PROMPT_DIRTY='±'
  4. function _git_prompt_info() {
  5. ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
  6. echo "${ref/refs\/heads\//⭠ }$(parse_git_dirty)"
  7. }
  8. function _git_info() {
  9. if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
  10. local BG_COLOR=green
  11. if [[ -n $(parse_git_dirty) ]]; then
  12. BG_COLOR=yellow
  13. fi
  14. echo "%{%K{$BG_COLOR}%}⮀%{%F{black}%} $(_git_prompt_info) %{%F{$BG_COLOR}%K{blue}%}⮀"
  15. else
  16. echo "%{%K{blue}%}⮀"
  17. fi
  18. }
  19. PROMPT_HOST='%{%b%F{gray}%K{black}%} %(?.%{%F{green}%}✔.%{%F{red}%}✘)%{%F{gray}%} %m %{%F{black}%}'
  20. PROMPT_DIR='%{%F{white}%} %1~ '
  21. PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}⮀%{%F{yellow}%} ⚡ %{%k%F{black}%}.%{%k%F{blue}%})⮀%{%f%k%b%}'
  22. PROMPT='%{%f%b%k%}
  23. $PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU '