diff options
author | Amir Yalon <amiryal@git> | 2009-07-28 22:54:51 +0800 |
---|---|---|
committer | Leonid Volnitsky <leonid@volnitsky.com> | 2009-08-09 21:38:06 +0800 |
commit | 1c00e93525940d6d1e1a525185927909de30a146 (patch) | |
tree | 8b8bb62cba3aa7e4f66d20e94424c972151786c0 | |
parent | fixed: svn module - removed forgotten debug statement (diff) | |
download | git-prompt-1c00e93525940d6d1e1a525185927909de30a146.tar.gz git-prompt-1c00e93525940d6d1e1a525185927909de30a146.tar.bz2 git-prompt-1c00e93525940d6d1e1a525185927909de30a146.zip |
Add control over color of user name.
Signed-off-by: Leonid Volnitsky <leonid@volnitsky.com>
-rw-r--r-- | git-prompt.conf | 1 | ||||
-rwxr-xr-x | git-prompt.sh | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/git-prompt.conf b/git-prompt.conf index a49221e..503ba94 100644 --- a/git-prompt.conf +++ b/git-prompt.conf @@ -43,6 +43,7 @@ # if [ 0`tput colors` -ge 8 ]; then # if terminal supports colors # dir_color=CYAN # rc_color=red + # user_id_color=blue # root_id_color=magenta # else # B/W terminal # dir_color=bw_bold diff --git a/git-prompt.sh b/git-prompt.sh index 8b3f812..f4bc46e 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -6,7 +6,7 @@ ##### read config file if any. - unset dir_color rc_color root_id_color init_vcs_color clean_vcs_color + unset dir_color rc_color user_id_color root_id_color init_vcs_color clean_vcs_color unset modified_vcs_color added_vcs_color addmoded_vcs_color untracked_vcs_color op_vcs_color detached_vcs_color conf=git-prompt.conf; [[ -r $conf ]] && . $conf @@ -28,6 +28,7 @@ if [ 0`tput colors` -ge 8 ]; then # if terminal supports colors dir_color=${dir_color:-CYAN} rc_color=${rc_color:-red} + user_id_color=${user_id_color:-blue} root_id_color=${root_id_color:-magenta} else # only B/W dir_color=${dir_color:-bw_bold} @@ -262,6 +263,7 @@ set_shell_label() { dir_color=${!dir_color} rc_color=${!rc_color} + user_id_color=${!user_id_color} root_id_color=${!root_id_color} ########################################################### HOST @@ -299,7 +301,7 @@ set_shell_label() { if [[ -n $id || -n $host ]] ; then [[ -n $id && -n $host ]] && at='@' || at='' - color_who_where="${id}$at${host:+$host_color$host}${tty:+ $tty}" + color_who_where="${id}${host:+$host_color$at$host}${tty:+ $tty}" plain_who_where="${id}$at$host" # add trailing " " @@ -307,9 +309,10 @@ set_shell_label() { plain_who_where="$plain_who_where " # if root then make it root_color - if [ "$id" == "root" ] ; then - color_who_where="$root_id_color$color_who_where$colors_reset" + if [ "$id" == "root" ] ; then + user_id_color=$root_id_color fi + color_who_where="$user_id_color$color_who_where$colors_reset" else color_who_where='' fi |