Skip to content

Commit

Permalink
Add virtualenv prompt for robbyrussell theme
Browse files Browse the repository at this point in the history
  • Loading branch information
petarnikolovski authored Jan 25, 2022
1 parent 2575d64 commit 1ec8f9d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion themes/robbyrussell/robbyrussell.theme.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1ec8f9d

Please sign in to comment.