Last active
January 25, 2016 15:31
-
-
Save ramonsnir/62123613f42adc08f058 to your computer and use it in GitHub Desktop.
Ramon.bgptheme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# your other stuff... | |
# git prompt | |
GIT_PROMPT_THEME=Ramon | |
GIT_PROMPT_ONLY_IN_REPO=0 | |
GIT_PROMPT_FETCH_REMOTE_STATUS=0 | |
. ~/.bash-git-prompt/gitprompt.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unset_git_prompt_colors() { | |
unset Time12a | |
unset PathShort | |
unset GIT_PROMPT_PREFIX | |
unset GIT_PROMPT_SUFFIX | |
unset GIT_PROMPT_SEPARATOR | |
unset GIT_PROMPT_BRANCH | |
unset GIT_PROMPT_STAGED | |
unset GIT_PROMPT_CONFLICTS | |
unset GIT_PROMPT_CHANGED | |
unset GIT_PROMPT_REMOTE | |
unset GIT_PROMPT_UNTRACKED | |
unset GIT_PROMPT_STASHED | |
unset GIT_PROMPT_CLEAN | |
unset GIT_PROMPT_COMMAND_OK | |
unset GIT_PROMPT_COMMAND_FAIL | |
unset GIT_PROMPT_VIRTUALENV | |
unset GIT_PROMPT_UPSTREAM | |
unset GIT_PROMPT_START_USER | |
unset GIT_PROMPT_START_ROOT | |
unset GIT_PROMPT_END_USER | |
unset GIT_PROMPT_END_ROOT | |
unset GIT_PROMPT_SYMBOLS_AHEAD | |
unset GIT_PROMPT_SYMBOLS_BEHIND | |
unset GIT_PROMPT_SYMBOLS_PREHASH | |
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING | |
} | |
define_helpers() { | |
Time12a="\$(date +%H:%M)" | |
JobCount="\j" | |
PathShort="\w" | |
PathDir="\W" | |
} | |
define_undefined_git_prompt_colors() { | |
if [ -z ${GIT_PROMPT_THEME_NAME+x} ]; then GIT_PROMPT_THEME_NAME="Ramon"; fi | |
# These are the color definitions used by gitprompt.sh | |
if [ -z ${GIT_PROMPT_PREFIX+x} ]; then GIT_PROMPT_PREFIX="["; fi # start of the git info string | |
if [ -z ${GIT_PROMPT_SUFFIX+x} ]; then GIT_PROMPT_SUFFIX="]"; fi # the end of the git info string | |
if [ -z ${GIT_PROMPT_SEPARATOR+x} ]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item | |
if [ -z ${GIT_PROMPT_BRANCH+x} ]; then GIT_PROMPT_BRANCH="${Green}"; fi # the git branch that is active in the current directory | |
if [ -z ${GIT_PROMPT_STAGED+x} ]; then GIT_PROMPT_STAGED="${Green}+ "; fi # the number of staged files/directories | |
if [ -z ${GIT_PROMPT_CONFLICTS+x} ]; then GIT_PROMPT_CONFLICTS="${BoldRed}✖ "; fi # the number of files in conflict | |
if [ -z ${GIT_PROMPT_CHANGED+x} ]; then GIT_PROMPT_CHANGED="${Red}* "; fi # the number of changed files | |
if [ -z ${GIT_PROMPT_REMOTE+x} ]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind | |
if [ -z ${GIT_PROMPT_UNTRACKED+x} ]; then GIT_PROMPT_UNTRACKED="${BoldRed}% "; fi # the number of untracked files/dirs | |
if [ -z ${GIT_PROMPT_STASHED+x} ]; then GIT_PROMPT_STASHED="${BoldBlue}⚑ "; fi # the number of stashed files/dir | |
if [ -z ${GIT_PROMPT_CLEAN+x} ]; then GIT_PROMPT_CLEAN="${Green}✔"; fi # a colored flag indicating a "clean" repo | |
# For the command indicator, the placeholder _LAST_COMMAND_STATE_ | |
# will be replaced with the exit code of the last command | |
# e.g. | |
# GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0 | |
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0 | |
if [ -z ${GIT_PROMPT_COMMAND_OK+x} ]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0 | |
if [ -z ${GIT_PROMPT_COMMAND_FAIL+x} ]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘"; fi # indicator if the last command returned with an exit code of other than 0 | |
# Possible to change which command is used to create git status information | |
# There are three options: | |
# 1) gitstatus.sh (uses git status --branch --porcelain - fast, requires git > 1.7.10) | |
# 2) gitstatus_pre-1.7.10.sh (Uses a variety of git commands and pipes - slower, works with older git clients) | |
# 3) gitstatus.py (Unsupported, lack features found in the bash versions) | |
if [ -z ${GIT_PROMPT_STATUS_COMMAND+x} ]; then GIT_PROMPT_STATUS_COMMAND="gitstatus.sh"; fi # Point out the command to get the git status from | |
# template for displaying the current virtual environment | |
# use the placeholder _VIRTUALENV_ will be replaced with | |
# the name of the current virtual environment (currently CONDA and VIRTUAL_ENV) | |
if [ -z ${GIT_PROMPT_VIRTUALENV+x} ]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi | |
# template for displaying the current remote tracking branch | |
# use the placeholder _UPSTREAM_ will be replaced with | |
# the name of the current remote tracking branch | |
if [ -z ${GIT_PROMPT_UPSTREAM+x} ]; then GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${ResetColor}}"; fi | |
# _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL | |
if [ -z ${GIT_PROMPT_START_USER+x} ]; then GIT_PROMPT_START_USER="${ResetColor}${PathShort}"; fi | |
if [ -z ${GIT_PROMPT_START_ROOT+x} ]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi | |
if [ -z ${GIT_PROMPT_END_USER+x} ]; then GIT_PROMPT_END_USER=" \n${ResetColor}[${Time12a} ${Green}${PathDir}${ResetColor}]$ "; fi | |
if [ -z ${GIT_PROMPT_END_ROOT+x} ]; then GIT_PROMPT_END_ROOT=" \n${ResetColor}[${Time12a} ]# "; fi | |
# Please do not add colors to these symbols | |
if [ -z ${GIT_PROMPT_SYMBOLS_AHEAD+x} ]; then GIT_PROMPT_SYMBOLS_AHEAD="↑"; fi # The symbol for "n versions ahead of origin" | |
if [ -z ${GIT_PROMPT_SYMBOLS_BEHIND+x} ]; then GIT_PROMPT_SYMBOLS_BEHIND="↓"; fi # The symbol for "n versions behind of origin" | |
if [ -z ${GIT_PROMPT_SYMBOLS_PREHASH+x} ]; then GIT_PROMPT_SYMBOLS_PREHASH="${Red}:"; fi # Written before hash of commit, if no name could be found | |
if [ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked | |
} | |
function prompt_callback { | |
jobsCount="$(jobs | grep -v git | wc -l)" | |
runningJobsCount="$(jobs | grep Running | wc -l)" | |
if (which ruby >/dev/null 2>&1); then | |
echo -n " (ruby $(ruby -v | head -c10 | tail -c5))" | |
fi | |
if [ $jobsCount -gt 0 ]; then | |
echo -n " jobs:($runningJobsCount/\j)" | |
fi | |
} | |
# call only from theme file | |
reload_git_prompt_colors() { | |
if [[ "${GIT_PROMPT_THEME_NAME}" != $1 ]]; then | |
unset_git_prompt_colors | |
define_helpers | |
override_git_prompt_colors | |
define_undefined_git_prompt_colors | |
fi | |
} | |
if [[ "${GIT_PROMPT_THEME}" == "Ramon" && "${GIT_PROMPT_THEME_NAME}" != "Ramon" ]]; then | |
define_helpers | |
define_undefined_git_prompt_colors | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment