git-info导致大项目处理prompt时会花巨长时间,故增加两个disable/enable_git_info一键切换是否显示git-info

This commit is contained in:
hophacker 2020-02-09 22:19:15 +08:00
parent f751d75940
commit 79d67c1baf

View File

@ -17,7 +17,9 @@ function prompt_skwp_precmd {
unsetopt XTRACE KSH_ARRAYS
# Get Git repository information.
if (( $+functions[git-info] )); then
if [[ $DISABLE_GIT_INFO == 1 ]]; then
git-info off
elif [[ $+functions[git-info] ]]; then
git-info on
git-info
fi
@ -72,4 +74,6 @@ function prompt_skwp_setup {
RPROMPT='%F{blue}${ruby_info[version]}'
}
alias disable_git_info='DISABLE_GIT_INFO=1'
alias enable_git_info='DISABLE_GIT_INFO=0'
prompt_skwp_setup "$@"