Skip to content
Andreas Pfrunder edited this page May 8, 2017 · 1 revision

Show git branch and make command line prompt nicer

Add the following to your bashrc:

__git_ps1 () 
{ 
    local b="$(git symbolic-ref HEAD 2>/dev/null)";
    if [ -n "$b" ]; then
        printf " (%s)" "${b##refs/heads/}";
    fi
}

export GIT_PS1_SHOWDIRTYSTATE=1

#PROMPT_HOSTNAME='SET_HERE'
PS1='\n\[\033[0;32m\]\u @ \w\[\033[02;36m\]$(__git_ps1)\[\033[01;34m\] \n\[\033[0;34m\]\t $ \[\033[0;39m\]'

Make bash autocomplete with up arrow

This allows you to start typing e.g. roslaunch bla and then use the up arrow to search for inputs which started identically.

# make bash autocomplete with up arrow
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward
Clone this wiki locally