linuxonly 2.7 KB

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