fix modern theme, added virtualenv name

pull/1812/head
tiago 2021-01-22 17:07:16 +00:00
parent 79df5ffc3c
commit c7f6e80ad0
1 changed files with 15 additions and 11 deletions

View File

@ -35,18 +35,22 @@ modern_scm_prompt() {
fi fi
} }
prompt() { detect_venv() {
if [ $? -ne 0 ] python_venv=""
then # Detect python venv
# Yes, the indenting on these is weird, but it has to be like if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
# this otherwise it won't display properly. python_venv="($PYTHON_VENV_CHAR${CONDA_DEFAULT_ENV})"
elif [[ -n "${VIRTUAL_ENV}" ]]; then
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) python_venv="($PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}"))"
${bold_red}└─▪${normal} "
else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell)
└─▪ "
fi fi
}
prompt() {
detect_venv
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)
└─▪ ${python_venv}${dir_color} "
} }
PS2="└─▪ " PS2="└─▪ "