@mdo

Improved Terminal hotness

January 13, 2013

A few months ago (!) I wrote about customizing your Terminal prompt. It would seem I had a bug in there that caused some awful wrapping in Terminal, but fret not, there is a solution. Matt Wright was kind enough to hit me up with a fix, so here are the new goods with instructions on how to update.

As you recall, here’s what we’re going for with our new Terminal prompt:

New Terminal prompt

To get us there, open ~/.bash_profile. If you already have a modified prompt, replace the existing similar line with this new snippet. If you don’t have one yet, just add the following snippet:

export PS1='\[\e[0:35m⌘\e[m \e[0:36m\w/\e[m \e[0:33m`git branch 2> /dev/null | grep -e ^* | sed -E  s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`\e[m\]'

Save and restart Terminal. Enjoy!