From 8b2d8d974edcf8249d675d2ceb6bf349c8c49b45 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Wed, 1 Jun 2022 13:04:45 +0200 Subject: [PATCH] upadte zsh prompt --- bundles/zsh/files/bw.zsh-theme | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bundles/zsh/files/bw.zsh-theme b/bundles/zsh/files/bw.zsh-theme index 5fc7a68..aed4e04 100644 --- a/bundles/zsh/files/bw.zsh-theme +++ b/bundles/zsh/files/bw.zsh-theme @@ -21,15 +21,20 @@ function spwd { echo } -if test "$EUID" -eq 0 -then - local root_color="%{$fg_bold[red]%}" -else - local root_color="%{$fg_bold[green]%}" -fi +function root_color { + if test "$EUID" -eq 0 + then + echo "%{$fg_bold[red]%}" + else + echo "%{$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)' +function exitcode_color { + echo "%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})" +} + +PROMPT='$(root_color)$(whoami)%{$reset_color%}@$(exitcode_color)$(hostname -s) %{$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%} "