allow prompt to skip expensive display functions conditionally

This commit is contained in:
Haak Saxberg 2020-02-12 23:18:58 -08:00
parent a4dbf3f519
commit 54c8938a24

View file

@ -103,6 +103,22 @@ in {
bindkey '^[[B' history-substring-search-down bindkey '^[[B' history-substring-search-down
bindkey -M viins 'jj' vi-cmd-mode bindkey -M viins 'jj' vi-cmd-mode
# utility for storing functions under a new name
save_function() {
local ORIG_FUNC=$(declare -f $1)
local NEWNAME_FUNC="$2''${ORIG_FUNC#$1}"
eval "$NEWNAME_FUNC"
}
# Override an oh-my-zsh/lib/git.sh function so that old repositories
# don't slow the shell down
save_function git_prompt_status old_git_prompt_status
function git_prompt_status() {
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
old_git_prompt_status
fi
}
eval "$(direnv hook zsh)" eval "$(direnv hook zsh)"
''); '');