浏览代码

Set colour for user@hostname to red if we're root (or sudo) in the bira theme.

L.C. Karssen 11 年之前
父节点
当前提交
a67dfae72b
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      themes/bira.zsh-theme

+ 7 - 1
themes/bira.zsh-theme

@@ -1,7 +1,13 @@
 # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
 # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
 local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
 
 
-local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
+
+if [[ $UID -eq 0 ]]; then
+    local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
+else
+    local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
+fi
+
 local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
 local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
 local rvm_ruby=''
 local rvm_ruby=''
 if which rvm-prompt &> /dev/null; then
 if which rvm-prompt &> /dev/null; then