how to modify conda 'source activate' ps1 behavior
The simplest solution I have found is to move the newline from PS1
to PROMPT_COMMAND
:
PROMPT_COMMAND="printf '\n'"
export PS1="\[$bldred\]\u\[$txtrst\]@\[$bldwht\]\h\[$txtrst\]:\[$bldcyn\]\w\[$txtrst\]$ "
This allows conda
to maintain it's default PS1
behavior all while separating bash commands with newlines:
user@short-domain:fullpath$ source activate <env-name-here>
(<env-name-here>) user@short-domain:fullpath$
Conda has a setting to disable changing the prompt: changeps1: False
(in ~/.condarc
). You can then add this yourself ($(basename "$CONDA_PREFIX")
).
This is similar to virtualenv, which doesn't update the prompt if $VIRTUAL_ENV_DISABLE_PROMPT
is set, so you can print $(basename "$VIRTUAL_ENV")
yourself.