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.

93 lines
2.8 KiB

3 years ago
  1. # Sunrise theme for oh-my-zsh
  2. # Intended to be used with Solarized: https://ethanschoonover.com/solarized
  3. # Color shortcuts
  4. R=$fg_no_bold[red]
  5. G=$fg_no_bold[green]
  6. M=$fg_no_bold[magenta]
  7. Y=$fg_no_bold[yellow]
  8. B=$fg_no_bold[blue]
  9. RESET=$reset_color
  10. if [ "$USERNAME" = "root" ]; then
  11. PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
  12. else
  13. PROMPTCOLOR="" PROMPTPREFIX="---";
  14. fi
  15. local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
  16. # Get the status of the working tree (copied and modified from git.zsh)
  17. custom_git_prompt_status() {
  18. INDEX=$(git status --porcelain 2> /dev/null)
  19. STATUS=""
  20. # Non-staged
  21. if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
  22. STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
  23. fi
  24. if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
  25. STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
  26. fi
  27. if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
  28. STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
  29. fi
  30. if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then
  31. STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
  32. elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
  33. STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
  34. elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
  35. STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
  36. fi
  37. # Staged
  38. if $(echo "$INDEX" | grep '^D ' &> /dev/null); then
  39. STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS"
  40. fi
  41. if $(echo "$INDEX" | grep '^R' &> /dev/null); then
  42. STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS"
  43. fi
  44. if $(echo "$INDEX" | grep '^M' &> /dev/null); then
  45. STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS"
  46. fi
  47. if $(echo "$INDEX" | grep '^A' &> /dev/null); then
  48. STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS"
  49. fi
  50. if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then
  51. STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS"
  52. fi
  53. echo $STATUS
  54. }
  55. # get the name of the branch we are on (copied and modified from git.zsh)
  56. function custom_git_prompt() {
  57. ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  58. echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX"
  59. }
  60. # %B sets bold text
  61. PROMPT='%B$PROMPTPREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
  62. RPS1="${return_code}"
  63. ZSH_THEME_GIT_PROMPT_PREFIX="%{$Y%}‹"
  64. ZSH_THEME_GIT_PROMPT_SUFFIX="%{$Y%}›%{$RESET%} "
  65. ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*"
  66. ZSH_THEME_GIT_PROMPT_CLEAN=""
  67. ZSH_THEME_GIT_PROMPT_AHEAD="%{$B%}➔"
  68. ZSH_THEME_GIT_STATUS_PREFIX=" "
  69. # Staged
  70. ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A"
  71. ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M"
  72. ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R"
  73. ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D"
  74. # Not-staged
  75. ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}?"
  76. ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M"
  77. ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D"
  78. ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU"