summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-11-03 05:21:47 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-11-03 05:21:47 +0300
commit44b4b669258f0854e17e439337a8a8fdf1dea5df (patch)
treee10d6f7b0bd839715ba30e334d30eb4497d15580 /functions
parentd07507c1ebf60d1d71ba491d0358b312e3e44807 (diff)
Speedup VCS segment
Now the untracked files are detected via `git ls-files`, which is much faster than `git status`. Additionally, we flipped the default for checking submodules. They are now NOT checked by default, as most users probably do not use git submodules.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/vcs.zsh16
1 files changed, 5 insertions, 11 deletions
diff --git a/functions/vcs.zsh b/functions/vcs.zsh
index cfc62a6d..6cc467d7 100755
--- a/functions/vcs.zsh
+++ b/functions/vcs.zsh
@@ -6,18 +6,12 @@
# https://github.com/bhilburn/powerlevel9k
################################################################
-set_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY true
+set_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY false
function +vi-git-untracked() {
- # TODO: check git >= 1.7.2 - see function git_compare_version()
- local FLAGS
- FLAGS=('--porcelain')
-
- if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "false" ]]; then
- FLAGS+='--ignore-submodules=dirty'
- fi
-
- if [[ $(command git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \
- -n $(command git status ${FLAGS} | \grep -E '^\?\?' 2> /dev/null | tail -n1) ]]; then
+ if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "true" && "$(command git submodule foreach 'git ls-files --others --exclude-standard')" != "" ]]; then
+ hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
+ VCS_WORKDIR_HALF_DIRTY=true
+ elif [[ "$(command git ls-files --others --exclude-standard)" != "" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
VCS_WORKDIR_HALF_DIRTY=true
else