]> git.rmz.io Git - dotfiles.git/commitdiff
zsh/prompt: show ahead/behing @{push} counters
authorSamir Benmendil <me@rmz.io>
Sat, 6 Feb 2021 13:13:18 +0000 (13:13 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 6 Feb 2021 13:13:18 +0000 (13:13 +0000)
zsh/lib/prompt.zsh

index 92b63a046fc00740544fad22adeec9697d74e50c..5b22231800a31b83be9d9870014047b20e6250be 100644 (file)
@@ -78,6 +78,13 @@ git_prompt_status() {
   (( behind > 0 )) && upstream_str+="%{$fg[blue]%} <$behind"
   git_status+="$upstream_str"
 
+  # Format push
+  push_ab=( $(git rev-list --left-right --count @...@{push} 2>/dev/null) )
+  if (( $? == 0 )); then
+    (( push_ab[1] > 0 )) && git_status+="%{$fg_bold[blue]%} ⮝$push_ab[1]"
+    (( push_ab[2] > 0 )) && git_status+="%{$fg_bold[blue]%} ⮟$push_ab[2]"
+  fi
+
   # Format stashed
   stashed=$(git stash list | wc -l)
   if (( stashed > 0 )) then