summaryrefslogtreecommitdiffstats
path: root/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.zshrc29
1 files changed, 29 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
index c618c09..a91e19e 100644
--- a/.zshrc
+++ b/.zshrc
@@ -56,4 +56,33 @@ alias help=run-help
autoload -Uz e v p bell
+zstyle ':vcs_info:*' check-for-changes true
+zstyle ':vcs_info:*' get-revision true
+zstyle ':vcs_info:*' formats "(%s)-[%b]%m%u%c"
+zstyle ':vcs_info:*' actionformats "(%s)-[%b]%m%u%c"
+
+zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
+
++vi-git-untracked() {
+ if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
+ git status --porcelain | grep -m 1 '^??' &>/dev/null
+ then
+ hook_com[misc]='T'
+ fi
+}
+
+zstyle ':vcs_info:git*+set-message:*' hooks git-st
+
+function +vi-git-st() {
+ local ahead behind
+ local -a gitstatus
+
+ ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
+ (( $ahead )) && gitstatus+=( "+${ahead}" )
+
+ behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
+ (( $behind )) && gitstatus+=( "-${behind}" )
+
+ hook_com[misc]+=${(j:/:)gitstatus}
+}