diff options
author | Dennis Eriksen <dennis@eriksen.im> | 2015-06-29 23:37:56 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis@eriksen.im> | 2015-06-29 23:37:56 +0200 |
commit | bb2fc9ae354af601374ea4ea8e481f727eaed201 (patch) | |
tree | 4b1da65846f7c38df5aeb8f076bac9c461df31e8 /prompt_adam3_setup | |
parent | added how you can test the prompt (diff) | |
download | adam3-bb2fc9ae354af601374ea4ea8e481f727eaed201.tar.gz |
make promptchar bold red if root
Diffstat (limited to 'prompt_adam3_setup')
-rw-r--r-- | prompt_adam3_setup | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/prompt_adam3_setup b/prompt_adam3_setup index 10fd35e..927955a 100644 --- a/prompt_adam3_setup +++ b/prompt_adam3_setup @@ -54,7 +54,7 @@ prompt_adam3_setup () { prompt_adam3_precmd () { # setopt noxtrace localoptions local base_prompt_expanded_no_color base_prompt_etc - local prompt_length space_left + local prompt_length space_left promptchar base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color") base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~") @@ -68,7 +68,12 @@ prompt_adam3_precmd () { space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 )) path_prompt="%B%F{$prompt_adam3_color4}%${space_left}<...<%~$prompt_newline%F{white}" fi - PS1="$base_prompt$path_prompt %# $post_prompt" + + # make promptchar bold red if root + if [[ $EUID == 0 ]]; then promptchar="%F{red}%B%#%b%f"; else promptchar="%#"; fi + + + PS1="$base_prompt$path_prompt $promptchar $post_prompt" PS2="$base_prompt$path_prompt %_> $post_prompt" PS3="$base_prompt$path_prompt ?# $post_prompt" } |