1
0

Git branch in bashrc

This commit is contained in:
Noah 2015-06-03 14:33:56 -07:00
parent b2733d1ea1
commit 2ec75b4cb2

View File

@ -80,12 +80,14 @@ elif [ "$TERM" = 'cygwin' ]; then
fi fi
# Custom bash prompt. # Custom bash prompt.
if [ "$ENLIGHTENED" = '1' ]; then git_branch() {
if [ `hostname` = 'fubar' ] || [ `hostname` = 'yakko' ]; then branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' | perl -pe 's/^\*\s+//g'`
export PS1="\[$CYAN\]\t \[$LIME\][\[$YELLOW\]\u\[$RED\]@\[$YELLOW\]\h \[$LIME\]\W\[$LIME\]]\[$BLUE\]\\$ \[$NC\]" if [ "$branch" != '' ]; then
else echo -n " ($branch)"
export PS1="\[$BOLD$BLUE\][\[$MAGENTA\]\u\[$BLUE\]@\[$MAGENTA\]\h \[$LIME\]\W\[$BLUE\]]\\$ \[$NC\]"
fi fi
}
if [ "$ENLIGHTENED" = '1' ]; then
export PS1="\[$BOLD$BLUE\][\[$MAGENTA\]\u\[$BLUE\]@\[$MAGENTA\]\h \[$LIME\]\W\[$CYAN\]\$(git_branch)\[$BLUE\]\[$BLUE\]]\\$ \[$NC\]"
fi fi
# For non-Fedora environments be sure the PROMPT_COMMAND sets the title bar. # For non-Fedora environments be sure the PROMPT_COMMAND sets the title bar.