linuxonly.zsh-theme 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. autoload -U add-zsh-hook
  2. autoload -Uz vcs_info
  3. local c0=$(printf "\033[0m")
  4. local c1=$(printf "\033[38;5;215m")
  5. local c2=$(printf "\033[38;5;209m")
  6. local c3=$(printf "\033[38;5;203m")
  7. local c4=$(printf "\033[33;4m")
  8. local c5=$(printf "\033[38;5;137m")
  9. local c6=$(printf "\033[38;5;240m")
  10. local c7=$(printf "\033[38;5;149m")
  11. local c8=$(printf "\033[38;5;126m")
  12. local c9=$(printf "\033[38;5;162m")
  13. if [ "$TERM" = "linux" ]; then
  14. c1=$(printf "\033[34;1m")
  15. c2=$(printf "\033[35m")
  16. c3=$(printf "\033[31m")
  17. c4=$(printf "\033[31;1m")
  18. c5=$(printf "\033[32m")
  19. c6=$(printf "\033[32;1m")
  20. c7=$(printf "\033[33m")
  21. c8=$(printf "\033[33;1m")
  22. c9=$(printf "\033[34m")
  23. fi
  24. zstyle ':vcs_info:*' actionformats \
  25. '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
  26. zstyle ':vcs_info:*' formats \
  27. "%{$c8%}%s%{$c7%}:%{$c7%}(%{$c9%}%b%{$c7%})%f "
  28. zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
  29. zstyle ':vcs_info:*' enable git
  30. add-zsh-hook precmd prompt_jnrowe_precmd
  31. prompt_jnrowe_precmd () {
  32. vcs_info
  33. if [ "${vcs_info_msg_0_}" = "" ]; then
  34. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  35. PROMPT='${dir_status} ${ret_status}%{$reset_color%}
  36. > '
  37. elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
  38. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  39. PROMPT='${vcs_info_msg_0_}
  40. ${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
  41. > '
  42. elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
  43. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  44. PROMPT='${vcs_info_msg_0_}
  45. ${dir_status}%{$reset_color%}
  46. %{$c9%}·>%{$c0%} '
  47. else
  48. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  49. PROMPT='${vcs_info_msg_0_}
  50. ${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
  51. > '
  52. fi
  53. }