jnrowe.zsh-theme 1015 B

12345678910111213141516171819202122232425262728293031323334353637
  1. autoload -U add-zsh-hook
  2. autoload -Uz vcs_info
  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 '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f '
  6. zstyle ':vcs_info:*' enable git
  7. add-zsh-hook precmd prompt_vcs
  8. prompt_vcs () {
  9. vcs_info
  10. if [ "${vcs_info_msg_0_}" = "" ]; then
  11. dir_status="%F{2}→%f"
  12. elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
  13. dir_status="%F{1}▶%f"
  14. elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
  15. dir_status="%F{3}▶%f"
  16. else
  17. dir_status="%F{2}▶%f"
  18. fi
  19. }
  20. function {
  21. if [[ -n "$SSH_CLIENT" ]]; then
  22. PROMPT_HOST=" ($HOST)"
  23. else
  24. PROMPT_HOST=''
  25. fi
  26. }
  27. local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)"
  28. PROMPT='${ret_status}%{$fg[blue]%}${PROMPT_HOST}%{$fg_bold[green]%} %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} '
  29. # vim: set ft=zsh ts=4 sw=4 et: