]> arthur.barton.de Git - ConfigScripts.git/commitdiff
Use colors in default bash prompt (PS1)
authorAlexander Barton <alex@barton.de>
Wed, 21 Jul 2010 13:12:44 +0000 (15:12 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 21 Jul 2010 13:12:44 +0000 (15:12 +0200)
sys/bashrc

index c32791c66f60ee614808aa7d0000de5867f5c3ab..8accc377173af15640adce041e596cb4b2486aca 100644 (file)
@@ -57,13 +57,20 @@ case "$TERM" in
 esac
 
 # Shell prompt
+PS1="${COLOR_PREPOSTTXT}${PS1_BEGIN:-<}"
 [ "$UID" -eq 0 ] \
-       && PS1="\h:\w \\\$ " \
-       || PS1="\u@\h:\w \\\$ "
-if [ "\$(type -t __git_ps1)" ]; then
-       PS1="\$(__git_ps1 '(%s) ')$PS1"
-fi
-PS1="${chroot_name:+[$chroot_name] }$PS1"
+       || PS1="${PS1}${COLOR_USER}\u${COLOR_AT}@"
+PS1="${PS1}${COLOR_HOST}\h"
+PS1="${PS1}${COLOR_COLON}:"
+PS1="${PS1}${COLOR_PATH}\w"
+PS1="${PS1}${COLOR_PREPOSTTXT}${PS1_END:->}${COLOR_RESET} "
+[ "$UID" -eq 0 ] \
+       && PS1="${PS1}${COLOR_PROMPT_ROOT}\\\$${COLOR_RESET} " \
+       || PS1="${PS1}${COLOR_PROMPT_USER}\\\$${COLOR_RESET} "
+[ "\$(type -t __git_ps1)" ] \
+       && PS1="\$(__git_ps1 '(${COLOR_VCS}%s${COLOR_RESET}) ')${PS1}"
+PS1="${chroot_name:+[${COLOR_CHROOT}$chroot_name${COLOR_RESET}] }${PS1}"
+PS1="${COLOR_RESET}${PS1}"
 
 # Enable bash completion, if available
 [ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] \