diff options
author | Robert Strack <robert.strack@gmail.com> | 2015-11-18 20:33:38 -0500 |
---|---|---|
committer | Robert Strack <robert.strack@gmail.com> | 2015-11-18 20:33:38 -0500 |
commit | de8d6841b00903f2873a8b009faf7002bfbc1273 (patch) | |
tree | 46ded32c0fb7c537f7c74cf0e6a30071486941b0 /plugins/timer | |
parent | 96148d2275b848dbfb976a58967535067def4210 (diff) | |
download | zsh-de8d6841b00903f2873a8b009faf7002bfbc1273.tar.gz zsh-de8d6841b00903f2873a8b009faf7002bfbc1273.tar.bz2 zsh-de8d6841b00903f2873a8b009faf7002bfbc1273.zip |
added pre_functions
Diffstat (limited to 'plugins/timer')
-rw-r--r-- | plugins/timer/timer.plugin.zsh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index f7f039b78..231134e7d 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -10,11 +10,11 @@ __timer_format_duration() { echo "${format//\%d/${duration_str#0m}}" } -preexec() { +__timer_save_time_preexec() { __timer_cmd_start_time=$(__timer_current_time) } -precmd() { +__timer_display_timer_precmd() { if [ -n "${__timer_cmd_start_time}" ]; then local cmd_end_time=$(__timer_current_time) local tdiff=$((cmd_end_time - __timer_cmd_start_time)) @@ -24,3 +24,6 @@ precmd() { echo -e "\033[1A\033[${cols}C ${tdiffstr}" fi } + +preexec_functions+=(__timer_save_time_preexec) +precmd_functions+=(__timer_display_timer_precmd) |