akhayyat theme: git info: detect ahead and behind in one shot
This commit is contained in:
parent
342a011541
commit
cb5e8c2b1a
1 changed files with 5 additions and 4 deletions
|
@ -89,13 +89,14 @@ function +vi-git-untracked {
|
|||
}
|
||||
|
||||
function +vi-git-st() {
|
||||
local ahead behind
|
||||
local ahead behind ahead_and_behind
|
||||
local -a gitstatus
|
||||
|
||||
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
(( $ahead )) && gitstatus+=( "%F{yellow}↑%f" )
|
||||
ahead_and_behind=$(git rev-list --count --left-right HEAD...@{upstream} 2>/dev/null)
|
||||
ahead=$ahead_and_behind[(w)1]
|
||||
behind=$ahead_and_behind[(w)2]
|
||||
|
||||
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
(( $ahead )) && gitstatus+=( "%F{yellow}↑%f" )
|
||||
(( $behind )) && gitstatus+=( "%F{$orange}↓%f" )
|
||||
|
||||
hook_com[misc]+=${(j:/:)gitstatus}
|
||||
|
|
Loading…
Add table
Reference in a new issue