TERM=xterm-color # \[ starts a sequence of non-printable chars # \] ends that sequence # \e[1m turns text that follows Bold # \e[m turns text that follows Normal # # \[\e[1m\] tells the shell not to count the non-printable bold command in it's wrapping calculations # \[\e[m\] tells the shell not to count the non-printable normal command in it's wrapping calculations # # Unlike HTML elements; this is more like ... It's important that the shell counts # the characters between and as printable in its line wrap calculations. parse_git_branch() { git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3- | sed -e 's/\(.*\)/ (\1)/' } PS1="\h:\W\[\e[1m\]\$(parse_git_branch)\[\e[m\] $ "