bash: ps1

This commit is contained in:
Michael Grote 2023-08-29 09:20:40 +02:00
parent bc9e269bd0
commit 3d545d2ef5

View file

@ -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 \[<wert>\] escaped, sonst kann die shelle die länge nicht richtig ausrechnen
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh