From 890236ced90ef1accd14c32d7de0eb7bebbfdcc6 Mon Sep 17 00:00:00 2001 From: Michael Aquilina Date: Wed, 17 Jul 2019 21:39:08 +0100 Subject: [PATCH] Rename reset_tracking and move function --- auto-notify.plugin.zsh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/auto-notify.plugin.zsh b/auto-notify.plugin.zsh index 868c4f5..7b17b35 100644 --- a/auto-notify.plugin.zsh +++ b/auto-notify.plugin.zsh @@ -7,15 +7,6 @@ export AUTO_NOTIFY_IGNORE=( "vim" "nvim" "less" "more" "man" "tig" "watch" "git commit" "top" "htop" "ssh" "nano" ) -function _reset_tracking() { - # Command start time in seconds since epoch - unset AUTO_COMMAND_START - # Full command that the user has executed after alias expansion - unset AUTO_COMMAND_FULL - # Command that the user has executed - unset AUTO_COMMAND -} - function _auto_notify_message() { local command="$1" local elapsed="$2" @@ -68,7 +59,7 @@ function _auto_notify_send() { # Empty tracking so that notifications are not # triggered for any commands not run (e.g ctrl+C when typing) - _reset_tracking + _auto_notify_reset_tracking } function _auto_notify_track() { @@ -77,6 +68,15 @@ function _auto_notify_track() { AUTO_COMMAND_START="$(date +"%s")" } +function _auto_notify_reset_tracking() { + # Command start time in seconds since epoch + unset AUTO_COMMAND_START + # Full command that the user has executed after alias expansion + unset AUTO_COMMAND_FULL + # Command that the user has executed + unset AUTO_COMMAND +} + function disable_auto_notify() { add-zsh-hook -D preexec _auto_notify_track add-zsh-hook -D precmd _auto_notify_send @@ -89,5 +89,5 @@ function enable_auto_notify() { autoload -Uz add-zsh-hook -_reset_tracking +_auto_notify_reset_tracking enable_auto_notify