oops accidentally fucked up the prompt

This commit is contained in:
Erin 2022-10-15 21:39:29 -04:00
parent b25aa8dffb
commit c07e94c639

View file

@ -7,24 +7,23 @@ function precmd {
vcs_info
# Start with a fresh prompt
RPROMPT=""
some_line=""
if [ -z $new_session ]; then
# If this is the first prompt in a session, there's not much to say
RPROMPT="%B%F{cyan}new session%f%b"
new_session=1
else
# Show exit code + more info about the last command run as a separate line
some_line="exited %B%(?.%F{green}%?%f.%F{red}%?%f)%b"
RPROMPT="exited %B%(?.%F{green}%?%f.%F{red}%?%f)%b"
if [ -z $timer ]; then
# If we never set $timer, preexec was never run (e.g. ^C at prompt)
some_line="$(print -P "%B%F{cyan}no exec%f%b, $some_line")"
RPROMPT=="$(print -P "%B%F{cyan}no exec%f%b, $RPROMPT")"
else
# Calculate elapsed real time for last command
now="$(date +%s.%N)"
if [[ $(($now - $timer)) > 0.5 ]]; then
timer_show=$(($now - $timer))
timer_show=$(printf '%.*f\n' 3 $timer_show)
some_line="took %B%F{cyan}${timer_show}s%f%b, $some_line"
RPROMPT="took %B%F{cyan}${timer_show}s%f%b, $RPROMPT"
fi
fi
fi