]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
zsh/rc: Use red # as prompt for root.
authorSimon Ruderich <simon@ruderich.org>
Mon, 16 Sep 2013 21:51:33 +0000 (23:51 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 16 Sep 2013 21:51:33 +0000 (23:51 +0200)
zsh/rc

diff --git a/zsh/rc b/zsh/rc
index 6b646b5a42ccec8a8bdbb2e55e6ea5e23ec3530a..4cd696785c37fc1f05edce10e59303bef7a61be2 100644 (file)
--- a/zsh/rc
+++ b/zsh/rc
@@ -418,6 +418,8 @@ zshrc_prompt_precmd() {
     local background="%(1j.${yellow}%j${default}.)"
     # Exit code in bright red in parentheses if not zero.
     local exitcode="%(?..(${red}%B%?%b${default}%) )"
+    # Prompt symbol, % for normal users, # in red for root.
+    local symbol="%(!.${red}#${default}.%%)"
 
     # Prefix characters in first and second line.
     local top_prefix="${blue}%B.-%b${default}"
@@ -452,7 +454,7 @@ zshrc_prompt_precmd() {
     local top_separator="%B${blue}${(l:${width}::-:)}%b${default}"
 
     PROMPT="${top_prefix}${top_left}${top_separator}${top_right}
-${bottom_prefix}${user}@${host} ${background}%# ${exitcode}"
+${bottom_prefix}${user}@${host} ${background}${symbol} ${exitcode}"
 }
 precmd_functions+=(zshrc_prompt_precmd)