diff options
-rw-r--r-- | bashrc | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -39,20 +39,38 @@ fi # ---------------------------------------------------------------------------- # # ----- New stuff usually goes here :-) -------------------------------------- # # ---------------------------------------------------------------------------- # +function get_git_branch() +{ + if [ -d "$PWD/.git" ] + then + branch=`cat $PWD/.git/HEAD | cut -d'/' -f 3` + eval "$1='$branch'" + fi +} + PATH=$HOME/.local/bin:$PATH PATH=$PATH:$HOME/scripts EDITOR=vim BROWSER=firefox #LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:*.deb=90' +PROMPT_COMMAND=' +get_git_branch branch +if [ "$branch" ] +then + branch="($branch) " +fi +default="\[$txtwht\] \W \[$txtylw\]$branch" if [ `whoami` == "root" ]; then - PS1="\[$bldred\](\h)\[$txtwht\] \W\[$bldred\] #\[$txtwht\]" + PS1="\[$bldred\](\h)$default\[$bldred\]# \[$txtwht\]" else if [ $UNDER_JHBUILD ]; then - PS1="\[$bldpur\](jhbuild)\[$txtwht\] \W\[$bldgrn\] $\[$txtwht\]" + PS1="\[$bldpur\](jhbuild)$default\[$bldgrn\]$ \[$txtwht\]" else - PS1="\[$bldgrn\](\h)\[$txtwht\] \W\[$bldgrn\] $\[$txtwht\]" + PS1="\[$bldgrn\](\h)$default\[$bldgrn\]$ \[$txtwht\]" fi fi - +unset branch +unset default +' # vim:ts=4:sw=4 |