From bc59ba0cdfad63b9b8d2810109091f72f306e8d5 Mon Sep 17 00:00:00 2001 From: Yax <1949284+kianby@users.noreply.github.com> Date: Sat, 17 Apr 2021 19:05:21 +0200 Subject: [PATCH] starship alternative --- dot_bashrc | 67 +++++++++++++++++--------------- private_dot_config/starship.toml | 10 +++++ 2 files changed, 45 insertions(+), 32 deletions(-) create mode 100644 private_dot_config/starship.toml diff --git a/dot_bashrc b/dot_bashrc index ced4958..ed1b28f 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -29,7 +29,6 @@ HISTFILESIZE=2000 # update the values of LINES and COLUMNS. shopt -s checkwinsize - # --------------------------------------------------------------------------- # EDITOR # --------------------------------------------------------------------------- @@ -43,30 +42,39 @@ export VISUAL=/usr/bin/vim # PROMPT # --------------------------------------------------------------------------- -# 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="#" +if [ -f "/usr/bin/starship" ]; then + eval "$(starship init bash)" else - PROMPT_USER_COLOR=$green - PROMPT_SYMBOL="$" + # 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 + source $HOME/.bash-git-prompt/gitprompt.sh + fi 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 " - # --------------------------------------------------------------------------- # ALIASES # --------------------------------------------------------------------------- @@ -86,13 +94,6 @@ alias vi='/usr/bin/vim' alias serve="python3 -m $(python3 -c 'import sys; print("http.server" if sys.version_info[:2] > (2,7) else "SimpleHTTPServer")')" -#---------------------------------------------------------------------------- - -if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then - GIT_PROMPT_ONLY_IN_REPO=1 - source $HOME/.bash-git-prompt/gitprompt.sh -fi - # ------------------------------------------------------------- # PYTHON # ------------------------------------------------------------- @@ -111,7 +112,9 @@ fi # Source all .bashrc files # ------------------------------------------------------------- -for file in ~/.bashrc.d/*.bashrc; do - . "$file" -done +if [ -d "$DIRECTORY" ]; then + for file in ~/.bashrc.d/*.bashrc; do + . "$file" + done +fi diff --git a/private_dot_config/starship.toml b/private_dot_config/starship.toml new file mode 100644 index 0000000..43c80d8 --- /dev/null +++ b/private_dot_config/starship.toml @@ -0,0 +1,10 @@ +# Inserts a blank line between shell prompts +add_newline = false + +[git_status] +ahead = "⇡${count}" +diverged = "⇕⇡${ahead_count}⇣${behind_count}" +behind = "⇣${count}" +staged = '[+${count}](green)' + +