Merge pull request #1817 from tiagobarros99/cleanup/modern-theme

Cleanup for modern theme
pull/1808/head
Noah Gorny 2021-01-28 12:25:07 +02:00 committed by GitHub
commit 25b3c96f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -47,6 +47,7 @@ themes/bobby-python
themes/brainy themes/brainy
themes/brunton themes/brunton
themes/command_duration.theme.bash themes/command_duration.theme.bash
themes/modern
# plugins # plugins
# #

View File

@ -1,3 +1,5 @@
# shellcheck shell=bash
SCM_THEME_PROMPT_PREFIX="" SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX="" SCM_THEME_PROMPT_SUFFIX=""
@ -19,14 +21,14 @@ esac
PS3=">> " PS3=">> "
is_vim_shell() { is_vim_shell() {
if [ ! -z "$VIMRUNTIME" ]; then if [ -n "$VIMRUNTIME" ]; then
echo "[${cyan}vim shell${normal}]" echo "[${cyan}vim shell${normal}]"
fi fi
} }
modern_scm_prompt() { modern_scm_prompt() {
CHAR=$(scm_char) CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]; then if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return return
else else
echo "[$(scm_char)][$(scm_prompt_info)]" echo "[$(scm_char)][$(scm_prompt_info)]"
@ -44,7 +46,8 @@ detect_venv() {
} }
prompt() { prompt() {
if [ $? -ne 0 ]; then retval=$?
if [[ retval -ne 0 ]]; then
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} " PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} "
else else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ " PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ "