From 3d545d2ef54a02458251e7568e56d0b2f8085ba0 Mon Sep 17 00:00:00 2001 From: mg Date: Tue, 29 Aug 2023 09:20:40 +0200 Subject: [PATCH] bash: ps1 --- .bash_extra | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.bash_extra b/.bash_extra index 9cd5501..1a3f0ca 100644 --- a/.bash_extra +++ b/.bash_extra @@ -9,14 +9,22 @@ eval "$(keychain -q --eval --timeout 60 --agents ssh,gpg)" export GPG_TTY=$(tty) ### PS1 +# Farben +BLUE='\[\e[34m\]' +GREEN='\[\e[32m\]' +RED='\[\e[31m\]' +YELLOW='\[\e[33m\]' +WHITE='\[\e[97m\]' +BLACK='\[\e[30m\]' +RESET='\[\e[0m\]' +ORANGE='\[e[0;33m\]' # git-symbole: * unstaged, + staged, $ stashed, % untracked export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWSTASHSTATE=1 -export PS1='\n\[\e[34m\]\u@\[\e[34m\]\h \[\e[94m\]\w\[\e[33m\]$(__git_ps1) \[\e[94m\]\[\e[35m\]$(code=${?##0};echo ${code:+[${code}]})\[\e[39m\]\n> ' - -#\e[34m \u @ \e[34m \h \e[37m \e[94m \w \e[33m $(__git_ps1) \e[94m \n> \e[39m -#Blau User @ Bue Hostname Light Gray LightBlue Verzeichnis Yellow Git-Script LightBlue Zeilenumbruch Standard-Vordergrund-Farbe +export GIT_PS1_SHOWUPSTREAM="verbose" +export GIT_PS1_SHOWCONFLICTSTATE="yes" +export PS1="\n${BLUE}\u${GREEN}@${ORANGE}\$(cat /etc/hostname) \$(pwd | sed -E -e "s#/#${RED}/${RESET}${GREEN}#g")${YELLOW}\$(__git_ps1)${RESET}\n> " # https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly # alle Farben sind mit \[\] escaped, sonst kann die shelle die länge nicht richtig ausrechnen # https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh