move RPROMPT to the line before the prompt

This commit is contained in:
Erin 2023-01-18 14:01:49 -05:00
parent 61370f555d
commit 2e8f04cbfb
2 changed files with 9 additions and 0 deletions

View file

@ -10,3 +10,7 @@ precmd_functions+="vcs_info"
# Prompt shows hostname if connected to a remote or if root
PROMPT="%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "cyan")}%n%f %F{blue}%~%f%b \${vcs_info_msg_0_}%B%#%b "
# The line before the prompt is used by RPROMPT for information about the previous command - leave space
NEWLINE=$'\n'
PROMPT="$NEWLINE$PROMPT"

View file

@ -38,6 +38,11 @@ function build_rprompt {
exittime="$(print -P "$timeformat")"
RPROMPT="$RPROMPT at $exittime"
# this is all info about the previous command, so put it up a line from the main prompt
lineup=$'\e[1A'
linedown=$'\e[1B'
RPROMPT="%{$lineup%}$RPROMPT%{$linedown%}"
# that's an RPROMPT!
export RPROMPT