ADD switch for zsh git prompt

This commit is contained in:
Nathan Dwarshuis 2022-02-17 23:06:59 -05:00
parent 79067b9506
commit 878302a1a8
1 changed files with 17 additions and 1 deletions

View File

@ -65,6 +65,18 @@ if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
HOSTNAME="@%M" HOSTNAME="@%M"
fi fi
## git prompt
zsh-git-off () {
export ZSH_USE_GIT=0
}
zsh-git-on () {
export ZSH_USE_GIT=1
}
zsh-git-on
PROMPT="" PROMPT=""
RPROMPT="" RPROMPT=""
@ -123,7 +135,11 @@ git_info() {
} }
function zle-line-init zle-keymap-select { function zle-line-init zle-keymap-select {
if [[ "$ZSH_USE_GIT" -eq 1 ]]; then
GIT=$(git_info) GIT=$(git_info)
else;
GIT=""
fi
NORMAL="%F{yellow}N%f" NORMAL="%F{yellow}N%f"
INSERT="%F{cyan}I%f" INSERT="%F{cyan}I%f"
VIMODE="─%B(${${KEYMAP/vicmd/$NORMAL}/(main|viins)/$INSERT})%b" VIMODE="─%B(${${KEYMAP/vicmd/$NORMAL}/(main|viins)/$INSERT})%b"