From b5601e86cc6aa8511722a2b450e1540e7af92f2f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Nov 2021 10:16:04 +0900 Subject: .zshrc: display stash count in VCS info --- .zshrc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to '.zshrc') 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() { -- cgit v1.2.3-70-g09d2