Skip to content

Instantly share code, notes, and snippets.

@p120ph37
Last active September 25, 2018 22:57
Show Gist options
  • Save p120ph37/eac1e38084cb8c9aee4091e4de410eb4 to your computer and use it in GitHub Desktop.
Save p120ph37/eac1e38084cb8c9aee4091e4de410eb4 to your computer and use it in GitHub Desktop.
A theme for https://github.com/magicmonty/bash-git-prompt, based on Single_line_Ubuntu, but with some spacing adjustment and with the Git path colorized and the branch name injected at the base of it rather than the end.
override_git_prompt_colors() {
gp_pwd() {
local git_top="$(git rev-parse --show-toplevel 2> /dev/null)"
case "$1" in
out) local out="${git_top:+$(dirname $git_top)/}"; out="${out:-$PWD}"; printf '%s' "${out/#$HOME/~}" ;;
in) printf '%s' "${git_top:+${PWD#$git_top}}" ;;
*) printf '%s' "${git_top:+$(basename $git_top)}" ;;
esac
}
# Based mostly on Single_line_Ubuntu, but with some excess space removed
GIT_PROMPT_THEME_NAME="Single_line_BadIdea"
GIT_PROMPT_LEADING_SPACE=0
GIT_PROMPT_PREFIX="["
GIT_PROMPT_SUFFIX="]"
GIT_PROMPT_SEPARATOR=""
GIT_PROMPT_STAGED=" ${Red}●${ResetColor}"
GIT_PROMPT_CONFLICTS=" ${Red}✖${ResetColor}"
GIT_PROMPT_CHANGED=" ${Blue}✚${ResetColor}"
GIT_PROMPT_REMOTE=" "
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
GIT_PROMPT_STASHED=" ${BoldBlue}⚑${ResetColor}"
GIT_PROMPT_CLEAN=" ${BoldGreen}✔${ResetColor}"
GIT_PROMPT_COMMAND_OK="${Green}✔"
GIT_PROMPT_COMMAND_FAIL="${Red}✘ (_LAST_COMMAND_STATE_)"
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${Cyan}\$(gp_pwd out)${Yellow}\$(gp_pwd)${ResetColor}"
local gp_end="${Yellow}\$(gp_pwd in)${ResetColor}"
GIT_PROMPT_END_USER="${gp_end}${ResetColor} $ "
GIT_PROMPT_END_ROOT="${gp_end}${BoldRed} # "
GIT_PROMPT_SYMBOLS_AHEAD=" ↑";
GIT_PROMPT_SYMBOLS_BEHIND=" ↓";
}
reload_git_prompt_colors "Single_line_BadIdea"
@p120ph37
Copy link
Author

p120ph37 commented Aug 2, 2018

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment