diff options
author | U-SYNOPSYS\jstolp <jstolp@jstolp-7490.internal.synopsys.com> | 2019-08-19 19:00:06 +0200 |
---|---|---|
committer | U-SYNOPSYS\jstolp <jstolp@jstolp-7490.internal.synopsys.com> | 2019-08-19 19:00:06 +0200 |
commit | 8bc9add56b55d524a1f22009de5c9a92db032f9d (patch) | |
tree | 36bbe5b41beab2f3e1b9b0c6a94179d0b36c42e4 | |
parent | d0d03fdaa849492f94c1c2504d389614e166b247 (diff) | |
download | dotfiles-8bc9add56b55d524a1f22009de5c9a92db032f9d.tar.gz dotfiles-8bc9add56b55d524a1f22009de5c9a92db032f9d.zip |
zshrc: added cmd time hooks
-rw-r--r-- | zshrc | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -173,6 +173,7 @@ color[brightRed]='%F{196}' color[pinkRed]='%F{125}' color[babyBlue]='%F{38}' color[darkBlue]='%F{26}' +color[green]='%F{2}' function printBase16() { for i in $(seq 0 15); do @@ -233,6 +234,26 @@ function _uninstallMyPrompt() { #_installMyPrompt _installMyPromptBase16 +# hooks see man zshmisc(1) + +function preexec_cmdTime() { + timer=$SECONDS +} + +function precmd_cmdTime() { + [[ ! -z $timer ]] && print -P "\-> $color[green]$(($SECONDS - $timer))$color[noColor]s" +} + +function enableCmdTime() { + preexec_functions+=(preexec_cmdTime) + precmd_functions+=(precmd_cmdTime) +} + +function disableCmdTime() { + preexec_functions=(${preexec_functions#preexec_cmdTime}) + precmd_functions=(${precmd_functions#precmd_cmdTime}) +} + # need to do after compinit zshPlug 'zsh-users/zsh-syntax-highlighting' |