From c8b9a46aad9975d679b1e2890726e372a48edcf7 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Wed, 1 Jun 2022 12:52:48 +0200 Subject: [PATCH] update zsh prompt --- bundles/zsh/files/bw.zsh-theme | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bundles/zsh/files/bw.zsh-theme b/bundles/zsh/files/bw.zsh-theme index dbb370e..5fc7a68 100644 --- a/bundles/zsh/files/bw.zsh-theme +++ b/bundles/zsh/files/bw.zsh-theme @@ -21,9 +21,15 @@ function spwd { echo } -local indicator="$(whoami)@$(hostname -s)" -local ret_status="%(?:%{$fg_bold[green]%}$indicator:%{$fg_bold[red]%}$indicator)" -PROMPT='${ret_status} %{$fg[cyan]%}$(spwd)%{$reset_color%} $(git_prompt_info)' +if test "$EUID" -eq 0 +then + local root_color="%{$fg_bold[red]%}" +else + local root_color="%{$fg_bold[green]%}" +fi + +local indicator="$root_color$(whoami)%{$fg_bold[black]%}@%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})$(hostname -s)" +PROMPT='${indicator} %{$fg[cyan]%}$(spwd)%{$reset_color%} $(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "