diff --git a/themes/robbyrussell/robbyrussell.theme.bash b/themes/robbyrussell/robbyrussell.theme.bash index 956347dd5e..8f7ffb334b 100644 --- a/themes/robbyrussell/robbyrussell.theme.bash +++ b/themes/robbyrussell/robbyrussell.theme.bash @@ -18,8 +18,19 @@ function git_prompt_info() { echo -e "$SCM_PREFIX${bold_red}$SCM_BRANCH$SCM_STATE$SCM_SUFFIX" } +function venv_prompt() { + python_venv="" + # Detect python venv + if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then + python_venv="($PYTHON_VENV_CHAR${CONDA_DEFAULT_ENV}) " + elif [[ -n "${VIRTUAL_ENV}" ]]; then + python_venv="($PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}")) " + fi + [[ -n "${python_venv}" ]] && echo "${python_venv}" +} + function prompt_command() { - PS1="${bold_green}➜ ${bold_cyan}\W${reset_color}$(scm_prompt_info)${normal} " + PS1="$(venv_prompt)${bold_green}➜ ${bold_cyan}\W${reset_color}$(scm_prompt_info)${normal} " } PROMPT_COMMAND=prompt_command