diff --git a/.bashrc b/.bashrc index 87287fe..0e35847 100644 --- a/.bashrc +++ b/.bashrc @@ -75,28 +75,41 @@ parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } -# set a fancy prompt -if [ $UID == 0 ]; then - # root: red - #PS_COLOR="\[\033[1;31m\]" - export PS1="\t \[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;7m\]@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;1m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\$(parse_git_branch)\[\033[00m\]\n\\$ \[$(tput sgr0)\]" +## set a fancy prompt +# --- 1. Color-Definitions (256-Colors) --- +# Format: \[ \033[38;5;COLOR_IDm \] ('m' marks the end of the code) + +# Reset standard text +F_RESET="\[\033[00m\]" + +# Colors for user +U_USER="\[\033[38;5;3m\]" # Gelb/Orange +U_PWD="\[\033[38;5;39m\]" # Angenehmes Himmelblau (hier ändern!) + +# Colors for Root +R_USER="\[\033[1;31m\]" # Fett, Rot (wichtig!) +R_PWD="\[\033[38;5;203m\]" # Sanfteres Lachsrosa (hier ändern!) + +# Common colors +C_HOST="\[\033[38;5;7m\]" # Hellgrau +C_GIT="\[\033[38;5;15m\]" # Weiß +C_CHAR="\[\033[38;5;15m\]" # Weiß (für Doppelpunkt) + + +# --- 2. Logic and Prompt-Composition --- +if [ "$UID" -eq 0 ]; then + # --- ROOT PROMPT --- + # Structure: Time [RootColor]User [Normal]@[Host] : [RootPath]Path [Git] \n # + export PS1="\t ${R_USER}\u${C_HOST}@\h${C_CHAR}:${R_PWD}\w${C_GIT}\$(parse_git_branch)$F_RESET\n# " else - # user - #PS_COLOR="\[\033[33m\]" - export PS1="\t \[$(tput sgr0)\]\[\033[38;5;3m\]\u\[$(tput sgr0)\]\[\033[38;5;7m\]@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;87m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\$(parse_git_branch)\[\033[00m\]\n\\$ \[$(tput sgr0)\]" + # --- USER PROMPT --- + # Structure: Time [UserFarbe]User [Normal]@[Host] : [PathFarbe]Path [Git] \n $ + export PS1="\t ${U_USER}\u${C_HOST}@\h${C_CHAR}:${U_PWD}\w${C_GIT}\$(parse_git_branch)$F_RESET\n\\$ " fi -#PS1="\t ${PS_COLOR}${debian_chroot:+($debian_chroot)}\u@\h:\w\$ " -#export PS1="\t \[$(tput sgr0)\]\[\033[38;5;11m\]\u\[$(tput sgr0)\]${PS_COLOR}@\h:\[$(tput sgr0)\]\[\033[38;5;87m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \n\\$ \[$(tput sgr0)\]" +# Cleanup (for the variables not to stau 'exported') +unset F_RESET U_USER U_PWD R_USER R_PWD C_HOST C_GIT C_CHAR -# if this is an xterm modify the title -case $TERM in -xterm*) - PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} $(date +%H:%M:%S) [${PWD}]\007"' - ;; -*) - ;; -esac # define your own aliases in ~/.bash_aliases [ -f ~/.bash_aliases ] && source ~/.bash_aliases