From aaf62b829f0857608e24b1057404f031b21afff5 Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Tue, 12 May 2020 12:16:41 +0200 Subject: [PATCH] zsh: Show fancy return codes --- zshrc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index 020540c..a3161ca 100644 --- a/zshrc +++ b/zshrc @@ -23,7 +23,17 @@ setopt prompt_subst if [ "$SSH_CONNECTION" ]; then PROMPT_HOST="%F{yellow}[ssh] $HOST%f " fi -export PROMPT='$PROMPT_HOST%(?..%F{red}%? )%f%20<…<%~%<<$(pretty-git-prompt) %F{117}>%f ' + +function ret { + case $? in + 0) ;; + 126) echo "%F{red}[PERMISSION]%f " ;; + 127) echo "%F{red}[NOTFOUND]%f " ;; + <129-254>) echo "%F{red}[SIG$(kill -l $(($? - 127)))]%f " ;; + *) echo "%F{red}$?%f " ;; + esac +} +export PROMPT='$PROMPT_HOST$(ret)%f%20<…<%~%<<$(pretty-git-prompt) %F{117}>%f ' HISTSIZE=20000 HISTFILE=~/.zsh_history