-
Notifications
You must be signed in to change notification settings - Fork 2
/
git.zsh
34 lines (30 loc) · 1.08 KB
/
git.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# vcsinfo stuff
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats " ($fg[magenta]%b$fg[white])%u%c%m"
zstyle ':vcs_info:*' actionformats " ($fg[magenta]%b$fg[white]|$fg[yellow]%a$fg[white])%u%c%m"
zstyle ':vcs_info:*' unstagedstr " $fg_no_bold[red]◼$fg[white]"
zstyle ':vcs_info:*' stagedstr " $fg[green]◼$fg[white]"
zstyle ':vcs_info:git+set-message:*' hooks stash ahead untracked
+vi-stash() {
if [[ -s ${hook_com[base]}/.git/refs/stash ]] ; then
local -a stash
stash=$(git stash list 2>/dev/null | wc -l)
hook_com[misc]+=" ($fg[yellow]stash$fg[white]:$fg[yellow]${stash}$fg[white])"
fi
}
+vi-ahead() {
ahead=$(git cherry 2>/dev/null | wc -l)
if [[ $ahead -gt 0 ]] ; then
hook_com[misc]+=" ($fg_bold[blue]ahead$fg[white])"
fi
}
+vi-untracked() {
untracked=$(git status -s 2>/dev/null | grep '??' | grep -v grep | wc -l)
if [[ $untracked -gt 0 ]] ; then
hook_com[misc]+=" ($fg_bold[blue]untracked$fg[white])"
fi
}
export GIT_EDITOR="emacsclient -t -a ''"