summaryrefslogtreecommitdiff
path: root/config/zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'config/zshrc')
-rw-r--r--config/zshrc/.zshrc12
1 files changed, 11 insertions, 1 deletions
diff --git a/config/zshrc/.zshrc b/config/zshrc/.zshrc
index c54e637..1a96877 100644
--- a/config/zshrc/.zshrc
+++ b/config/zshrc/.zshrc
@@ -81,9 +81,19 @@ add-zsh-hook -Uz precmd rehash_precmd
# prompt
PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ '
-RPROMPT='%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)'
+RPROMPT='%F{red}$(parse_git_remote)$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)'
setopt prompt_subst
+parse_git_remote() {
+ b="$(git branch -vv 2>/dev/null | grep "^*" | sed 's/^.\+: \([^ ]\+\) .\+$/\1/')"
+ if [ "$b" = "behind" ]
+ then
+ echo -n "v "
+ elif [ "$b" = "ahead" ]
+ then
+ echo -n "^ "
+ fi
+}
parse_git_branch() {
git symbolic-ref --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null
}