From f7ebd0e09dbed83f948f8a2d4862e5d5b704d98a Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 4 Mar 2023 23:29:54 -0500 Subject: [PATCH] Add support for Zim duration-info module --- fred-prompt.zsh-theme | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fred-prompt.zsh-theme b/fred-prompt.zsh-theme index 16b7cdb..92ba75f 100644 --- a/fred-prompt.zsh-theme +++ b/fred-prompt.zsh-theme @@ -1,5 +1,6 @@ # -*-mode: sh-*- # My mess of various themes +# Optionally uses Zim modules git-info and duration-info setopt nopromptbang promptcr promptpercent promptsp promptsubst @@ -32,10 +33,17 @@ if (( ${+functions[git-info]} )); then autoload -Uz add-zsh-hook && add-zsh-hook precmd git-info fi +if (( ${+functions[duration-info-preexec]} )); then + zstyle ':zim:duration-info' threshold 1 + zstyle ':zim:duration-info' format '(%d) ' + add-zsh-hook preexec duration-info-preexec + add-zsh-hook precmd duration-info-precmd +fi + # Define prompts. local userHost='%B%(!.%F{red}.%F{green})%n@${SSH_CLIENT:+%F{blue\}}%m%f%b' # user@host local pathString='%F{cyan}%$((($COLUMNS-20) / 4 ))<..<%~%f' # /path/to/wd local gitInfo='${(e)git_info[prompt]}' # branch:action local promptChar='%B%(!.%F{red}.%F{cyan})${PREFIX}%f%b' PS1="$userHost $pathString$gitInfo$promptChar " -RPS1='${editor_info[overwrite]}%(?:: %F{red}%?'$ERROR_CHAR'%f) ${(e)git_info[rprompt]}' +RPS1='${editor_info[overwrite]}%(?:: %F{red}%?'$ERROR_CHAR'%f) ${duration_info}${(e)git_info[rprompt]}'