Detect python venv and show in prompt
parent
7dd5b3a67f
commit
185257e971
|
|
@ -88,7 +88,14 @@ function _prompt {
|
||||||
ssh_info="${bold_blue}\u${bold_orange}@${cyan}$host ${bold_orange}in"
|
ssh_info="${bold_blue}\u${bold_orange}@${cyan}$host ${bold_orange}in"
|
||||||
fi
|
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} -gt $((COLUMNS*3)) ]] && wrap_char="\\n"
|
||||||
PS1="${PS1}${wrap_char}❯${normal} "
|
PS1="${PS1}${wrap_char}❯${normal} "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue