From f443dc03cdab3e015e986e594aeb70076d31b16a Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 15 May 2024 17:44:01 +0800 Subject: [PATCH] feat: change apple logo color based on previous return code --- themes/apple.zsh-theme | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme index 0c183258e..abff2ce41 100644 --- a/themes/apple.zsh-theme +++ b/themes/apple.zsh-theme @@ -1,5 +1,10 @@ function toon { - echo -n "" + r=$? + if [ $r -eq 0 ]; then + echo -n "%{$fg[magenta]%}" + else + echo -n "[$r]" + fi } autoload -Uz vcs_info @@ -18,7 +23,7 @@ theme_precmd () { } setopt prompt_subst -PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' +PROMPT='$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' autoload -U add-zsh-hook add-zsh-hook precmd theme_precmd