diff --git a/rainbow.zsh-theme b/rainbow.zsh-theme index de47b9f..a055b62 100644 --- a/rainbow.zsh-theme +++ b/rainbow.zsh-theme @@ -4,6 +4,7 @@ # Fork from shellder # +RAINBOW_KEEP_PATH=0 # # Segment drawing # @@ -458,6 +459,14 @@ preexec() { timer=$SECONDS } +precmd() { + if [ $timer ]; then + local now=$SECONDS + elapsed=$(($now-$timer)) + unset timer + fi +} + prompt_error() { if [ $RETVAL -ne 0 ] && [ "$preexec_called" = 1 ]; then prompt_segment_right $RAINBOW_STATUS_ERROR_BG $RAINBOW_STATUS_ERROR_FG '✘ %? ' @@ -478,11 +487,7 @@ prompt_status() { } prompt_excursion_time() { - if [ $timer ]; then - now=$SECONDS - elapsed=$(($now-$timer)) - unset $timer; - unset $now; + if [ $elapsed ]; then hours=$(($elapsed/3600)) min=$(($elapsed/60))