Minimal.bgptheme 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ##############################################################################
  2. # Changes the prompt to a Debian-style one that truncates pwd to a max length
  3. # depending on the terminal column width. Also uses the prompt_callback
  4. # function of bash-git-prompt to set the window title to almost the same
  5. # Debian-style. This version has been tweaked for Ubuntu standard terminal
  6. # fonts.
  7. #
  8. # The prompt will use a Debian-style on the form
  9. #
  10. # relative-path-from-git-toplevel-dir bash-git-prompt-info <exit status>
  11. # HH:MM:SS ▶
  12. #
  13. # The window title will have the form
  14. # relative-path-from-git-toplevel-dir
  15. #
  16. # Example usage:
  17. # if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
  18. # GIT_PROMPT_THEME=Minimal
  19. # source ~/.bash-git-prompt/gitprompt.sh
  20. # fi
  21. #
  22. # Imbibinebe <imbibinebe@gmail.com> [https://github.com/imbibinebe]
  23. ##############################################################################
  24. override_git_prompt_colors() {
  25. GIT_PROMPT_THEME_NAME="Minimal"
  26. #Overrides the prompt_callback function used by bash-git-prompt
  27. function prompt_callback {
  28. GIT_CONTAINER_FOLDER_FULLPATH=$(git rev-parse --show-toplevel 2> /dev/null)
  29. GIT_CONTAINER_FOLDER=$(basename $GIT_CONTAINER_FOLDER_FULLPATH 2> /dev/null)
  30. CURRENT_FULLPATH=$(pwd)
  31. local PS1=$GIT_CONTAINER_FOLDER${CURRENT_FULLPATH#$GIT_CONTAINER_FOLDER_FULLPATH}
  32. gp_set_window_title "$PS1"
  33. echo -n "${BoldYellow}${PS1}${ResetColor}"
  34. }
  35. Time12a="\$(date +%H:%M:%S)"
  36. GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
  37. GIT_PROMPT_MASTER_BRANCH="${GIT_PROMPT_MASTER_BRANCH}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES
  38. GIT_PROMPT_PREFIX="" # start of the git info string
  39. GIT_PROMPT_SUFFIX="" # the end of the git info string
  40. GIT_PROMPT_SEPARATOR="" # separates each item
  41. GIT_PROMPT_STAGED=" ${Green}●" # the number of staged files/directories
  42. GIT_PROMPT_CONFLICTS=" ${BoldRed}✖" # the number of files in conflict
  43. GIT_PROMPT_CHANGED=" ${BoldBlue}✚" # the number of changed files
  44. # GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind
  45. GIT_PROMPT_UNTRACKED=" ${Cyan}…" # the number of untracked files/dirs
  46. GIT_PROMPT_STASHED=" ${BoldCyan}⚑" # the number of stashed files/dir
  47. GIT_PROMPT_CLEAN=" ${BoldGreen}✔" # a colored flag indicating a "clean" repo
  48. local gp_end="_LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
  49. GIT_PROMPT_START_USER=""
  50. GIT_PROMPT_END_USER="${gp_end} ▶ "
  51. GIT_PROMPT_END_ROOT="${gp_end} /!!!\ "
  52. GIT_PROMPT_COMMAND_OK="${Green} ✔ " # indicator if the last command returned with an exit code of 0
  53. GIT_PROMPT_COMMAND_FAIL="${BoldRed} ✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0
  54. }
  55. reload_git_prompt_colors "Minimal"