X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=bashrc;fp=bashrc;h=f312fc00a78dd39e1f525b7080bc54e8666bf6ba;hp=f50d7ccc640c301107652f80894597d27116eeff;hb=750f872cb118f152b3cf7c1756486667e472aa18;hpb=9a5a6e9982b31d81af59d9210e5938e50a72f855 diff --git a/bashrc b/bashrc index f50d7cc..f312fc0 100644 --- a/bashrc +++ b/bashrc @@ -908,6 +908,20 @@ function mvtoconfig () { fi } + +###################################################################### +# git prompt + +if which > /dev/null git +then + + parse_git_branch() { + git 2>/dev/null rev-parse --abbrev-ref HEAD | sed -e 's/^\(.*\)$/(\1) /' + } + + export PS_GIT="${VT_WHITE_BG}${VT_GREEN_FG}\$(parse_git_branch)${VT_RESET}" +fi + ###################################################################### # The complex prompt policy @@ -955,7 +969,7 @@ else fi -PS1="${PSCUE}${PS1}" +PS1="${PS_GIT}${PSCUE}${PS1}" ###################################################################### # This implements a local history. If we are in a directory containing