From 54c8938a24445a94730d9e2037b06b3637684699 Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Wed, 12 Feb 2020 23:18:58 -0800 Subject: [PATCH] allow prompt to skip expensive display functions conditionally --- nix/home.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nix/home.nix b/nix/home.nix index e07495a..89baf11 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -103,6 +103,22 @@ in { bindkey '^[[B' history-substring-search-down 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)" '');