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.

47 lines
1.1 KiB

3 years ago
  1. #
  2. # Based on Geoffrey Grosenbach's peepcode zsh theme from
  3. # https://github.com/topfunky/zsh-simple
  4. #
  5. git_repo_path() {
  6. command git rev-parse --git-dir 2>/dev/null
  7. }
  8. git_commit_id() {
  9. command git rev-parse --short HEAD 2>/dev/null
  10. }
  11. git_mode() {
  12. if [[ -e "$repo_path/BISECT_LOG" ]]; then
  13. echo "+bisect"
  14. elif [[ -e "$repo_path/MERGE_HEAD" ]]; then
  15. echo "+merge"
  16. elif [[ -e "$repo_path/rebase" || -e "$repo_path/rebase-apply" || -e "$repo_path/rebase-merge" || -e "$repo_path/../.dotest" ]]; then
  17. echo "+rebase"
  18. fi
  19. }
  20. git_dirty() {
  21. if [[ "$repo_path" != '.' && -n "$(command git ls-files -m)" ]]; then
  22. echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
  23. fi
  24. }
  25. git_prompt() {
  26. local cb=$(git_current_branch)
  27. if [[ -n "$cb" ]]; then
  28. local repo_path=$(git_repo_path)
  29. echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
  30. fi
  31. }
  32. local smiley='%(?.%F{green}☺%f.%F{red}☹%f)'
  33. PROMPT='
  34. ${VIRTUAL_ENV:+"($VIRTUAL_ENV) "}%~
  35. ${smiley} '
  36. RPROMPT='%F{white} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}'
  37. # Disable automatic virtualenv prompt change
  38. export VIRTUAL_ENV_DISABLE_PROMPT=1