summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorDan Wallis <mrdanwallis@gmail.com>2022-12-09 18:10:04 +0000
committerGitHub <noreply@github.com>2022-12-09 19:10:04 +0100
commitc189e8b40c2a9ed15850d5bb5a68e6789be5fc70 (patch)
treedec5bfdbce8590af2ba9496bcc0b48b67beae31f /themes
parentcc5100d1e9e3d843ab93a12a5b0bac71ae0425f3 (diff)
downloadzsh-c189e8b40c2a9ed15850d5bb5a68e6789be5fc70.tar.gz
zsh-c189e8b40c2a9ed15850d5bb5a68e6789be5fc70.tar.bz2
zsh-c189e8b40c2a9ed15850d5bb5a68e6789be5fc70.zip
feat(agnoster): add remote-tracking status to prompt (#7209)
Diffstat (limited to 'themes')
-rw-r--r--themes/agnoster.zsh-theme11
1 files changed, 11 insertions, 0 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 5f4efe813..88854eccd 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -116,6 +116,17 @@ prompt_git() {
prompt_segment green $CURRENT_FG
fi
+ local ahead behind
+ ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
+ behind=$(git log --oneline ..@{upstream} 2>/dev/null)
+ if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
+ PL_BRANCH_CHAR=$'\u21c5'
+ elif [[ -n "$ahead" ]]; then
+ PL_BRANCH_CHAR=$'\u21b1'
+ elif [[ -n "$behind" ]]; then
+ PL_BRANCH_CHAR=$'\u21b0'
+ fi
+
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then