summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
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'