diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 9e4a2562fa..cb7e8570a7 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -625,3 +625,14 @@ function _save-and-reload-history() { local autosave=${1:-0} [[ $autosave -eq 1 ]] && history -a && history -c && history -r } + +function conda_or_venv_prompt() { + local python_venv="" + if [[ -n "${CONDA_DEFAULT_ENV:-}" ]]; then + python_venv=$(condaenv_prompt) + PYTHON_VENV_CHAR=${CONDA_PYTHON_VENV_CHAR} + elif [[ -n "${VIRTUAL_ENV:-}" ]]; then + python_venv=$(virtualenv_prompt) + fi + [[ -n "${python_venv}" ]] && echo "${PYTHON_VENV_CHAR}${python_venv}" +} diff --git a/themes/robbyrussell/robbyrussell.theme.bash b/themes/robbyrussell/robbyrussell.theme.bash index 956347dd5e..5edd0e67f3 100644 --- a/themes/robbyrussell/robbyrussell.theme.bash +++ b/themes/robbyrussell/robbyrussell.theme.bash @@ -13,13 +13,16 @@ GIT_THEME_PROMPT_SUFFIX="${bold_blue})" RVM_THEME_PROMPT_PREFIX="|" RVM_THEME_PROMPT_SUFFIX="|" +VIRTUALENV_THEME_PROMPT_PREFIX='(' +VIRTUALENV_THEME_PROMPT_SUFFIX=') ' + function git_prompt_info() { git_prompt_vars echo -e "$SCM_PREFIX${bold_red}$SCM_BRANCH$SCM_STATE$SCM_SUFFIX" } function prompt_command() { - PS1="${bold_green}➜ ${bold_cyan}\W${reset_color}$(scm_prompt_info)${normal} " + PS1="$(conda_or_venv_prompt)${bold_green}➜ ${bold_cyan}\W${reset_color}$(scm_prompt_info)${normal} " } PROMPT_COMMAND=prompt_command