Prompt additions for Git shell
This file contains 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
# | |
# PLACE THE CONTENTS IN YOUR ~/.bashrc | |
# AFTERWARDS YOU'LL NEED TO RELOAD IT: source ~/.bashrc | |
# | |
# Colors | |
BLACK='\[\e[0;30m\]' | |
BLUE='\[\e[0;34m\]' | |
GREEN='\[\e[0;32m\]' | |
CYAN='\[\e[0;36m\]' | |
RED='\[\e[0;31m\]' | |
PURPLE='\[\e[0;35m\]' | |
BROWN='\[\e[0;33m\]' | |
LIGHTGRAY='\[\e[0;37m\]' | |
DARKGRAY='\[\e[1;30m\]' | |
LIGHTBLUE='\[\e[1;34m\]' | |
LIGHTGREEN='\[\e[1;32m\]' | |
LIGHTCYAN='\[\e[1;36m\]' | |
LIGHTRED='\[\e[1;31m\]' | |
LIGHTPURPLE='\[\e[1;35m\]' | |
YELLOW='\[\e[1;33m\]' | |
WHITE='\[\e[1;37m\]' | |
NC='\[\033[00m\]' #'\e[0m' # No Color | |
# make git branch show up in prompt | |
parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ git:\1/' ; } | |
parse_has_git_submodules() { | |
if [ -f .gitmodules ]; then | |
echo "*" | |
fi | |
} | |
function git_prompt_additions | |
{ | |
if [ $? -eq 0 ]; then | |
echo "$(parse_git_branch)$(parse_has_git_submodules)" | |
else | |
echo "died: $?" >> /tmp/gitrclog | |
fi | |
} | |
export PS1="${YELLOW}\w${CYAN}\$(git_prompt_additions)${NC} " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment