From 4f0fe1d32f01a94da69f0ad94deb96a8cd898133 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Mon, 19 Feb 2018 12:38:00 -0800 Subject: [PATCH] Add last exit code to zsh prompt --- zsh/.zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 3d3fcee..94c896c 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -5,6 +5,7 @@ SAVEHIST=1000000 DIRSTACKSIZE=100 setopt appendhistory extendedglob nomatch setopt autopushd pushdsilent pushdtohome histignorespace +setopt printexitvalue unsetopt beep autocd notify bindkey -e # End of lines configured by zsh-newuser-install @@ -59,10 +60,11 @@ else fi local dir="${green}%~%f" local branch="\$(parse_git_branch)" +local exit_code="%(?.${green}.${red})%?%f" setopt prompt_subst export PROMPT="${prompt}" -export RPROMPT="${lbrkt}${user}${colon}${host}${colon}${dir}${branch}${rbrkt}" +export RPROMPT="${exit_code} ${lbrkt}${user}${colon}${host}${colon}${dir}${branch}${rbrkt}" # aliases source $HOME/.config/zsh/aliases