summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
authorU-SYNOPSYS\jstolp <jstolp@jstolp-7490.internal.synopsys.com>2019-08-19 19:00:06 +0200
committerU-SYNOPSYS\jstolp <jstolp@jstolp-7490.internal.synopsys.com>2019-08-19 19:00:06 +0200
commit8bc9add56b55d524a1f22009de5c9a92db032f9d (patch)
tree36bbe5b41beab2f3e1b9b0c6a94179d0b36c42e4 /zshrc
parentd0d03fdaa849492f94c1c2504d389614e166b247 (diff)
downloaddotfiles-8bc9add56b55d524a1f22009de5c9a92db032f9d.tar.gz
dotfiles-8bc9add56b55d524a1f22009de5c9a92db032f9d.zip
zshrc: added cmd time hooks
Diffstat (limited to 'zshrc')
-rw-r--r--zshrc21
1 files changed, 21 insertions, 0 deletions
diff --git a/zshrc b/zshrc
index d128190..42766c7 100644
--- a/zshrc
+++ b/zshrc
@@ -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'