diff options
Diffstat (limited to '')
| -rw-r--r-- | config/zsh/plugins/timer.zsh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/config/zsh/plugins/timer.zsh b/config/zsh/plugins/timer.zsh new file mode 100644 index 0000000..73d9673 --- /dev/null +++ b/config/zsh/plugins/timer.zsh @@ -0,0 +1,13 @@ +function preexec() { + timer=$(($(date +%s%0N)/1000000)) +} + +function precmd() { + if [ $timer ]; then + now=$(($(date +%s%0N)/1000000)) + elapsed=$(($now-$timer)) + + export RPROMPT="%F{magenta}${elapsed}ms %{$reset_color%}" + unset timer + fi +} |
