linuxonly.zsh-theme 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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:*' enable git
  29. add-zsh-hook precmd prompt_jnrowe_precmd
  30. prompt_jnrowe_precmd () {
  31. vcs_info
  32. if [ "${vcs_info_msg_0_}" = "" ]; then
  33. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  34. PROMPT='${dir_status} ${ret_status}%{$reset_color%}
  35. > '
  36. elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
  37. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  38. PROMPT='${vcs_info_msg_0_}
  39. ${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
  40. > '
  41. elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then
  42. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  43. PROMPT='${vcs_info_msg_0_}
  44. ${dir_status}%{$reset_color%}
  45. %{$c9%}·>%{$c0%} '
  46. else
  47. dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})"
  48. PROMPT='${vcs_info_msg_0_}
  49. ${dir_status} ${vcs_info_msg_0_}%{$reset_color%}
  50. > '
  51. fi
  52. }