diff --git a/dot_bashrc.tmpl b/dot_bashrc.tmpl index 5b334ef..748b2a8 100644 --- a/dot_bashrc.tmpl +++ b/dot_bashrc.tmpl @@ -45,46 +45,6 @@ export GIT_EDITOR=$EDITOR export VISUAL=$EDITOR alias vi=$EDITOR -# --------------------------------------------------------------------------- -# PROMPT -# --------------------------------------------------------------------------- - -if hash starship 2>/dev/null; then - eval "$(starship init bash)" -else - # set a minimalist prompt - red='\[\e[0;31m\]' # Red - green='\[\e[0;32m\]' # Green - blue='\[\e[0;34m\]' # Bold Blue - boldred='\[\e[1;31m\]' # Bold Red - reset='\[\e[0m\]' # Text Reset - - if [ "$USER" = "root" ] ; then - # $bold$red - PROMPT_USER_COLOR=$boldred - PROMPT_SYMBOL="#" - else - PROMPT_USER_COLOR=$green - PROMPT_SYMBOL="$" - fi - - if [[ -n "$SSH_CLIENT$SSH2_CLIENT$SSH_TTY" ]] ; then - PROMPT_SSH="@\h" - else - PROMPT_SSH="" - fi - - PS1="$PROMPT_USER_COLOR\u$PROMPT_SSH $blue\w$reset $PROMPT_SYMBOL " - - if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then - GIT_PROMPT_ONLY_IN_REPO=1 - GIT_PROMPT_IGNORE_SUBMODULES=1 - GIT_PROMPT_WITH_VIRTUAL_ENV=0 - GIT_PROMPT_THEME=Solarized_Yax - source $HOME/.bash-git-prompt/gitprompt.sh - fi -fi - # --------------------------------------------------------------------------- # ALIASES # --------------------------------------------------------------------------- @@ -193,3 +153,43 @@ fi # enable history set -o history +# --------------------------------------------------------------------------- +# PROMPT +# --------------------------------------------------------------------------- + +# starship must be evaluated at the end to catch properly error codes +if hash starship 2>/dev/null; then + eval "$(starship init bash)" +else + # set a minimalist prompt + red='\[\e[0;31m\]' # Red + green='\[\e[0;32m\]' # Green + blue='\[\e[0;34m\]' # Bold Blue + boldred='\[\e[1;31m\]' # Bold Red + reset='\[\e[0m\]' # Text Reset + + if [ "$USER" = "root" ] ; then + # $bold$red + PROMPT_USER_COLOR=$boldred + PROMPT_SYMBOL="#" + else + PROMPT_USER_COLOR=$green + PROMPT_SYMBOL="$" + fi + + if [[ -n "$SSH_CLIENT$SSH2_CLIENT$SSH_TTY" ]] ; then + PROMPT_SSH="@\h" + else + PROMPT_SSH="" + fi + + PS1="$PROMPT_USER_COLOR\u$PROMPT_SSH $blue\w$reset $PROMPT_SYMBOL " + + if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then + GIT_PROMPT_ONLY_IN_REPO=1 + GIT_PROMPT_IGNORE_SUBMODULES=1 + GIT_PROMPT_WITH_VIRTUAL_ENV=0 + GIT_PROMPT_THEME=Solarized_Yax + source $HOME/.bash-git-prompt/gitprompt.sh + fi +fi \ No newline at end of file