]> code.delx.au - dotfiles/commitdiff
bash: Show git branch in prompt, split up PS1 to make reading easier
authorJames Bunton <jamesbunton@delx.net.au>
Sat, 1 Sep 2012 06:05:14 +0000 (16:05 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Sat, 1 Sep 2012 06:05:14 +0000 (16:05 +1000)
.bash/colors

index 22e83a11e29d9ec2082fc845275d0dec1de06b27..a3cc78e4e4071341375a261d94aff8f218dbcfe4 100644 (file)
@@ -61,7 +61,14 @@ fi
 # depending on the background of the terminal.
 if [ ${PS1_COLOR:-0} -eq 1 ]; then
        eval $(TERM=xterm dircolors 2> /dev/null)
-       PS1='${debian_chroot:+($debian_chroot)}\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]\n\$ '
+
+       if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
+               debian_chroot=$(cat /etc/debian_chroot)
+       fi
+       PS1='${debian_chroot:+($debian_chroot)}'
+       PS1="$PS1"'\[\033[00;31m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[00m\]'
+       PS1="$PS1"'\[\033[00;36m\]$(__git_ps1 2>/dev/null)\[\033[00m\]'
+       PS1="$PS1"'\n\$ '
 
        if [ ${DARK} -eq 0 ]; then
                LS_COLORS="$(echo "${LS_COLORS}" | sed 's/01;/00;/g')"