aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2021-11-07 10:16:04 +0900
committernsfisis <nsfisis@gmail.com>2021-11-07 10:16:04 +0900
commitb5601e86cc6aa8511722a2b450e1540e7af92f2f (patch)
tree29e59d71ae0ab1ce83bd0ed819688735795be5ee
parent818119a7fd2e8131769b35f54841b69b28bac983 (diff)
downloaddotfiles-b5601e86cc6aa8511722a2b450e1540e7af92f2f.tar.gz
dotfiles-b5601e86cc6aa8511722a2b450e1540e7af92f2f.tar.zst
dotfiles-b5601e86cc6aa8511722a2b450e1540e7af92f2f.zip
.zshrc: display stash count in VCS info
-rw-r--r--.zshrc15
1 files changed, 12 insertions, 3 deletions
diff --git a/.zshrc b/.zshrc
index 46b92d3..596d401 100644
--- a/.zshrc
+++ b/.zshrc
@@ -269,10 +269,19 @@ zmodload zsh/complist
autoload -Uz vcs_info
+zstyle ':vcs_info:git:*' formats ' (%b)%u%m'
+zstyle ':vcs_info:git:*' actionformats ' (%b %a)%u%m'
+zstyle ':vcs_info:git:*' unstagedstr '+'
zstyle ':vcs_info:git:*' check-for-changes true
-zstyle ':vcs_info:git:*' unstagedstr "+"
-zstyle ':vcs_info:*' formats " (%b)%u"
-zstyle ':vcs_info:*' actionformats ' (%b %a)%u'
+zstyle ':vcs_info:git+set-message:*' hooks git-stash-count
+
+# Add stash count to VCS info.
+function +vi-git-stash-count() {
+ local stash="$(git stash list 2>/dev/null | wc -l | tr -d ' ')"
+ if [[ "${stash}" -gt 0 ]]; then
+ hook_com[misc]+=" [${stash}]"
+ fi
+}
function __update_vcs_info() {