After watching Ondrej's git videos, I became jealous of the (branch name) at
the end of his bash prompt.  I googled around and was able to put something
together that I like.  The trick was getting it to work in color.
Especially tricky for me was getting back to the default white after the
branch name.  I found that I could get either light gray or bold white,
neither of which I liked.  But a code that doesn't really make sense to bash
seems to get me back to the default.

I added these to my .bashrc:
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\...@\h:\w\[\e[0;33m\]\$(parse_git_branch)\[\e[0;39m\]$ "

where \[\e[0;33m\] switches to a medium yellow and \[\e[0;39m\] switches
back to the default white (for me).

I borrowed ideas from these places:

How to get the branch name in the prompt:
http://eddorre.com/tags/bash

how to tweak the other things in the prompt:
http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-2.html

and how to put things in color:
http://wiki.archlinux.org/index.php/Color_Bash_Prompt

Ondrej may have a cleaner solution, but I like it a lot.

Ryan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to