From d3f7e2c155930985426228bbcd4dad7bffdf358e Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 1 Apr 2015 07:08:31 -0400 Subject: [PATCH] Rearranged runtime functions --- liquidprompt | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/liquidprompt b/liquidprompt index 2253d38..f2b83d4 100755 --- a/liquidprompt +++ b/liquidprompt @@ -1336,25 +1336,8 @@ _lp_runtime() fi } -if [ "$_LP_SHELL_zsh" ] ; then - function precmd() { - if [ $timer ]; then - export _LP_RUNTIME_SECONDS=$(($SECONDS - $timer)) - unset timer - fi - } - - function preexec() { - export timer=${timer:-$SECONDS} - } -fi - _lp_reset_runtime() { - if $_LP_SHELL_zsh; then - return - fi - # Compute number of seconds since program was started _LP_RUNTIME_SECONDS=$((SECONDS - _LP_RUNTIME_LAST_SECONDS)) @@ -1369,8 +1352,21 @@ _lp_reset_runtime() if [ "$LP_ENABLE_RUNTIME" = 1 ] then - # _lp_reset_runtime gets called whenever bash executes a command - trap '_lp_reset_runtime' DEBUG + if "$_LP_SHELL_zsh"; then + function precmd() { + if [ $timer ]; then + export _LP_RUNTIME_SECONDS=$(($SECONDS - $timer)) + unset timer + fi + } + + function preexec() { + export timer=${timer:-$SECONDS} + } + else + # _lp_reset_runtime gets called whenever bash executes a command + trap '_lp_reset_runtime' DEBUG + fi fi ###############