OK, so this is really weird. It turns out that the problem was that I was using double quotes. When I changed it to single quotes as in
PS1='\[\e[31;40m\]\h:\W \u\[\e[0;33m\]$(__git_ps1 "(%s)")\[\e[31;40m\]$ \[\e[0m\]' It changes as expected. Is the behavior the same in Linux? If so, it probably has something to do with the way bash handles single quote and double quote strings that I don't know about because I don't know any bash. Otherwise, it is a strange Mac OS X "feature". A commenter on the blog you linked to said that you need to escape the first $ to get this to work, but for me escaping makes it not work. You might put that in there too though because it might be different for linux or something. I wouldn't use my prompt as an example, as it looks kind of bad if your terminal does not have a black background and all the color stuff kind of distracts from the point anyway. Probably a better example is export PS1='\w$(__git_ps1 "(%s)")$' which is pretty simple and straight forward (and works on my machine). Lastly, reading the /git-completion.bash file, it looks like you can set the GIT_PS1_SHOWDIRTYSTATE environment variable to a non-empty value to show a * next to the branch name for unstaged changes and a + for staged changes and the GIT_PS1_SHOWSTASHSTATE environment variable to a nonempty value to show a $ next to the branch name if something is stashed. Aaron Meurer On Jun 23, 2009, at 2:41 PM, Ondrej Certik wrote: > > On Tue, Jun 23, 2009 at 2:01 PM, asmeurer<[email protected]> wrote: >> >> OK I fixed that. I had too many $'s. The problem now is that it >> doesn't change when I switch a branch or after cd'ing into and out of >> a git directory. Ondrej's PS1 changes (though I get >> aaronmeu...@macintosh:~/Documents/python/sympy/sympy33[31m(odes| >> BISECTING)33[00m$ for my prompt on Mac OS X), but I cannot figure out >> what is different in it. This is kind of useless unless it changes. >> >> Here is what I have: export PS1="\[\e[31;40m\]\h:\W \u\[\e[0m\]\[\e >> [0;33m\]$(__git_ps1 "(%s)")\[\e[31;40m\]\$\[\e[0m\]" > > Ok, start with thing that works, e.g. my prompt, and remove some of > the color changing sequences that don't seem to work in your terminal. > > Post here when you figure it out, we'll put it into the documentation, > I plan to overhaul this page soon: > > http://docs.sympy.org/sympy-patches-tutorial.html > > with videos and updodate info about git. Any help is of course > welcome. :) You can help for example by posting here a prompt that > works etc. > > Ondrej > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---
