zsh: Show fancy return codes

This commit is contained in:
Sijmen 2020-05-12 12:16:41 +02:00
parent 37dac9b013
commit aaf62b829f
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

12
zshrc
View file

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