my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

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