From 878302a1a8b8853c6127a332235c9a591ae7ae67 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Thu, 17 Feb 2022 23:06:59 -0500 Subject: [PATCH] ADD switch for zsh git prompt --- dot_config/zsh/dot_zshrc.tmpl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dot_config/zsh/dot_zshrc.tmpl b/dot_config/zsh/dot_zshrc.tmpl index 7cb0ded..82fa8af 100644 --- a/dot_config/zsh/dot_zshrc.tmpl +++ b/dot_config/zsh/dot_zshrc.tmpl @@ -65,6 +65,18 @@ if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then HOSTNAME="@%M" fi +## git prompt + +zsh-git-off () { + export ZSH_USE_GIT=0 +} + +zsh-git-on () { + export ZSH_USE_GIT=1 +} + +zsh-git-on + PROMPT="" RPROMPT="" @@ -123,7 +135,11 @@ git_info() { } function zle-line-init zle-keymap-select { - GIT=$(git_info) + if [[ "$ZSH_USE_GIT" -eq 1 ]]; then + GIT=$(git_info) + else; + GIT="" + fi NORMAL="%F{yellow}N%f" INSERT="%F{cyan}I%f" VIMODE="─%B(${${KEYMAP/vicmd/$NORMAL}/(main|viins)/$INSERT})%b"