When I am in my virtualenv and it's active, the name of the environment appears in parentheses before the normal command line prompt. It looks like: (foo-env)User:~/Development/foo-env/foo$
where foo-env
is the name of the environment. I was wondering if there was a way to make it that the command line prompt displayed something like (F)User:~/Development/foo-env/foo$
as opposed to the current display with (foo-env)
. If this is possible how would I go about doing this?
So I figured out how to do this. In the activate script the $PS1
is redefined to prepend the name of the env, in this case (foo-env)
. In order to prepend it with whatever you want you have to go into the activate
script that you run to activate the virtualenv
([yourenv]/bin/activate]
). There you change the line that that defines the new $PS1
from PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
to be whatever you want, here PS1="(F)$PS1"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With