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.7 KiB

3 years ago
  1. # prompt style and colors based on Steve Losh's Prose theme:
  2. # https://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
  3. #
  4. # vcs_info modifications from Bart Trojanowski's zsh prompt:
  5. # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
  6. #
  7. # git untracked files modification from Brian Carper:
  8. # https://briancarper.net/blog/570/git-info-in-your-zsh-prompt
  9. #use extended color palette if available
  10. if [[ $TERM = (*256color|*rxvt*) ]]; then
  11. turquoise="%{${(%):-"%F{81}"}%}"
  12. orange="%{${(%):-"%F{166}"}%}"
  13. purple="%{${(%):-"%F{135}"}%}"
  14. hotpink="%{${(%):-"%F{161}"}%}"
  15. limegreen="%{${(%):-"%F{118}"}%}"
  16. else
  17. turquoise="%{${(%):-"%F{cyan}"}%}"
  18. orange="%{${(%):-"%F{yellow}"}%}"
  19. purple="%{${(%):-"%F{magenta}"}%}"
  20. hotpink="%{${(%):-"%F{red}"}%}"
  21. limegreen="%{${(%):-"%F{green}"}%}"
  22. fi
  23. autoload -Uz vcs_info
  24. # enable VCS systems you use
  25. zstyle ':vcs_info:*' enable git svn
  26. # check-for-changes can be really slow.
  27. # you should disable it, if you work with large repositories
  28. zstyle ':vcs_info:*:prompt:*' check-for-changes true
  29. # set formats
  30. # %b - branchname
  31. # %u - unstagedstr (see below)
  32. # %c - stagedstr (see below)
  33. # %a - action (e.g. rebase-i)
  34. # %R - repository path
  35. # %S - path in the repository
  36. PR_RST="%{${reset_color}%}"
  37. FMT_BRANCH=" on ${turquoise}%b%u%c${PR_RST}"
  38. FMT_ACTION=" performing a ${limegreen}%a${PR_RST}"
  39. FMT_UNSTAGED="${orange} ●"
  40. FMT_STAGED="${limegreen} ●"
  41. zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}"
  42. zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}"
  43. zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
  44. zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
  45. zstyle ':vcs_info:*:prompt:*' nvcsformats ""
  46. function steeef_chpwd {
  47. PR_GIT_UPDATE=1
  48. }
  49. function steeef_preexec {
  50. case "$2" in
  51. *git*|*svn*) PR_GIT_UPDATE=1 ;;
  52. esac
  53. }
  54. function steeef_precmd {
  55. (( PR_GIT_UPDATE )) || return
  56. # check for untracked files or updated submodules, since vcs_info doesn't
  57. if [[ -n "$(git ls-files --other --exclude-standard 2>/dev/null)" ]]; then
  58. PR_GIT_UPDATE=1
  59. FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${hotpink} ●${PR_RST}"
  60. else
  61. FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${PR_RST}"
  62. fi
  63. zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
  64. vcs_info 'prompt'
  65. PR_GIT_UPDATE=
  66. }
  67. # vcs_info running hooks
  68. PR_GIT_UPDATE=1
  69. autoload -U add-zsh-hook
  70. add-zsh-hook chpwd steeef_chpwd
  71. add-zsh-hook precmd steeef_precmd
  72. add-zsh-hook preexec steeef_preexec
  73. # ruby prompt settings
  74. ZSH_THEME_RUBY_PROMPT_PREFIX="with%F{red} "
  75. ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}"
  76. ZSH_THEME_RVM_PROMPT_OPTIONS="v g"
  77. setopt prompt_subst
  78. PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} "