Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Detect python venv and show in prompt
  • Loading branch information
8F3E committed Sep 22, 2020
1 parent 7dd5b3a commit 185257e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion themes/barbuk/barbuk.theme.bash
Expand Up @@ -88,7 +88,14 @@ function _prompt {
ssh_info="${bold_blue}\u${bold_orange}@${cyan}$host ${bold_orange}in"
fi

PS1="\\n${ssh_info} ${purple}$(scm_char)${dir_color}\\w${normal}$(scm_prompt_info)${exit_code}"
# Detect python venv
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
python_venv="${CONDA_DEFAULT_ENV}"
elif [[ -n "${VIRTUAL_ENV}" ]]; then
python_venv=$(basename "${VIRTUAL_ENV}")
fi

PS1="\\n${ssh_info} ${python_venv} ${purple}$(scm_char)${dir_color}\\w${normal}$(scm_prompt_info)${exit_code}"

[[ ${#PS1} -gt $((COLUMNS*3)) ]] && wrap_char="\\n"
PS1="${PS1}${wrap_char}${normal} "
Expand Down

0 comments on commit 185257e

Please sign in to comment.