From 3922505cb991082794cc0c10dd9b8be281445698 Mon Sep 17 00:00:00 2001 From: Gea-Suan Lin Date: Fri, 29 Jun 2012 13:32:39 +0800 Subject: [PATCH] Add branch prompt support --- .bashrc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.bashrc b/.bashrc index 5fec96d..8074178 100644 --- a/.bashrc +++ b/.bashrc @@ -54,11 +54,20 @@ fi # [[ -s "/etc/bash_completion" ]] && source "/etc/bash_completion" [[ -s "/usr/local/etc/bash_completion" ]] && source "/usr/local/etc/bash_completion" +[[ -s "/usr/local/share/git-core/contrib/completion/git-completion.bash" ]] && source "/usr/local/share/git-core/contrib/completion/git-completion.bash" # if [ -z "$WINDOW" ]; then - PS1='\[\e[G\e[0m\e[32m\]\u\[\e[0m\]@\[\e[36m\]\h\[\e[0m\] [\[\e[32m\]\w\[\e[0m\]] [\[\e[36m\]\A\[\e[0m\]] ' + if type __git_ps1; then + PS1='\[\e[G\e[0m\e[32m\]\u\[\e[0m\]@\[\e[36m\]\h\[\e[0m\] [\[\e[32m\]\w\[\e[0m\]] [\[\e[36m\]\A\[\e[0m\]]\[\e[1;30m\]$(__git_ps1)\[\e[m\] ' + else + PS1='\[\e[G\e[0m\e[32m\]\u\[\e[0m\]@\[\e[36m\]\h\[\e[0m\] [\[\e[32m\]\w\[\e[0m\]] [\[\e[36m\]\A\[\e[0m\]]\[\e[1;30m\] ' + fi else - PS1='\[\e[G\e[0m\e[32m\]\u\[\e[0m\]@\[\e[36m\]\h\[\e[0m\] [\[\e[32m\]\w\[\e[0m\]] [\[\e[36m\]\A\[\e[0m\]/\[\e[36m\]W$WINDOW\[\e[0m\]] ' + if type __git_ps1; then + PS1='\[\e[G\e[0m\e[32m\]\u\[\e[0m\]@\[\e[36m\]\h\[\e[0m\] [\[\e[32m\]\w\[\e[0m\]] [\[\e[36m\]\A\[\e[0m\]/\[\e[36m\]W$WINDOW\[\e[0m\]]\[\e[1;30m\]$(__git_ps1)\[\e[m\] ' + else + PS1='\[\e[G\e[0m\e[32m\]\u\[\e[0m\]@\[\e[36m\]\h\[\e[0m\] [\[\e[32m\]\w\[\e[0m\]] [\[\e[36m\]\A\[\e[0m\]/\[\e[36m\]W$WINDOW\[\e[0m\]]\[\e[1;30m\] ' + fi fi # [[ -s "$HOME/.bashrc.local" ]] && source "$HOME/.bashrc.local"