dotfiles/.bash_ps1

22 lines
994 B
Bash
Raw Permalink Normal View History

2024-05-06 23:00:05 +02:00
# 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 GIT_PS1_SHOWCONFLICTSTATE="yes"
export PS1="\n${BLUE}\u${GREEN}@${ORANGE}\$(cat /etc/hostname) ${GREEN}\$(dirs +0 | 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 shell die länge nicht richtig ausrechnen
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# https://gist.github.com/justintv/168835
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
# Zeige letzte Exit-Code: https://stackoverflow.com/questions/16715103/bash-prompt-with-the-last-exit-code