feat: change apple logo color based on previous return code

This commit is contained in:
Ian 2024-05-15 17:44:01 +08:00
commit f443dc03cd
Failed to extract signature

View file

@ -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