-# The contents of /etc/debian_chroot will be printed in the prompt. You can
-# create this file in chroot environments to know where you are.
-if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
+##################
+# Terminal setup #
+##################
+
+# Check for unsupported TERM variable
+if ! tput init &> /dev/null; then
+ echo "Warning! TERM=$TERM unsupported, using TERM=xterm"
+ export TERM=xterm
+fi
+
+# Disable CTRL-s / CTRL-q
+stty -ixon
+
+# Sets colour scheme in apps like Vim
+export COLORFGBG="15;0"
+
+
+
+#############
+# Fancy PS1 #
+#############
+
+# Revision control status for git, hg, svn
+
+[ -r /usr/share/git/completion/git-prompt.sh ] && source /usr/share/git/completion/git-prompt.sh
+function my_git_ps1 {
+ find_up_recurse .git || return
+ GIT_PS1_SHOWDIRTYSTATE=1 \
+ GIT_PS1_SHOWUNTRACKEDFILES=1 \
+ __git_ps1 2> /dev/null
+}
+
+function my_hg_ps1 {
+ find_up_recurse .hg || return
+ b="$(hg branch 2>/dev/null)" || return
+ s="$(hg status | cut -c1 | sort -u | tr -d " \n")"
+ echo -n " ($b"
+ [ -n "$s" ] && echo -n " $s"
+ echo -n ")"
+}
+
+function my_svn_ps1 {
+ find_up_recurse .svn || return
+ s="$(svn status --ignore-externals 2>/dev/null | cut -c1 | sort -u | tr -d " \n")"
+ [ -z "$s" ] && return
+ echo -n " ($s)"
+}
+
+# Two line prompt
+
+PS1=''
+PS1="$PS1"'\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]'
+PS1="$PS1"'\[\033[01;36m\]$(my_git_ps1 ; my_hg_ps1 ; my_svn_ps1)\[\033[00m\]'
+PS1="$PS1"'\n\$ '
+
+
+
+################
+# xterm titles #
+################
+
+# hostname:workingdir
+DISPLAY_TITLE_COMMAND='echo -ne "\033]0;$(hostname| cut -d. -f1):${PWD/$HOME/~}\007"'
+
+if [[ "$TERM" =~ ^xterm ]]; then
+ PROMPT_COMMAND="$DISPLAY_TITLE_COMMAND"
+fi
+
+if [[ "$TERM" =~ ^screen ]]; then
+ PROMPT_COMMAND="${DISPLAY_TITLE_COMMAND}; echo -ne '\033k\033\\'"