1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Functions
function ssh_state {
if [ -n "$SSh_CONNECTION" ]; then
echo "%{$fg[red]%}<%{$fg[white]%}SSH%{$fg[red]%}> "
fi
}
function collapse_pwd {
if [[ $(pwd) == $HOME ]]; then
echo $(pwd)
else
echo $(pwd | sed -e "s,^$HOME,~,")
fi
}
function error_code {
if [[ $? == 0 ]]; then
echo ""
else
echo "%{$fg[white]%}<%{$fg[red]%}%?%{$fg[white]%}>%{$reset_color%}"
fi
}
last_command='%(?.>>.<<)'
## Prompts
PROMPT='
%{$fg[red]%}<%{$fg[white]%}$(collapse_pwd)%{$fg[red]%}> $(ssh_state)
%{$fg[white]%}$last_command%{$reset_color%} '
RPROMPT='$(error_code)%{$reset_color%}'
|
x
Notes
“I can’t believe it’s not butter!” series.
I only show the prompt because the rest of the conf is really strongly inspired (some would stay stolen) from the most favored ones here.