From 3542212e14eda5822a28a5d7c7a98d0ef68644c1 Mon Sep 17 00:00:00 2001 From: Daniel Garnier-Moiroux Date: Wed, 8 Jul 2020 12:23:27 +0200 Subject: [PATCH] First stab at git-duet prompt segment --- config/p10k-classic.zsh | 5 +++++ config/p10k-lean-8colors.zsh | 1 + config/p10k-lean.zsh | 1 + config/p10k-rainbow.zsh | 1 + internal/p10k.zsh | 10 ++++++++++ 5 files changed, 18 insertions(+) diff --git a/config/p10k-classic.zsh b/config/p10k-classic.zsh index 83eb89ac..d73af899 100644 --- a/config/p10k-classic.zsh +++ b/config/p10k-classic.zsh @@ -90,6 +90,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # git_duet # git duet (https://github.com/git-duet/git-duet) # time # current time # =========================[ Line #2 ]========================= newline # \n @@ -1493,6 +1494,10 @@ # Custom prefix. # typeset -g POWERLEVEL9K_TIME_PREFIX='%248Fat ' + ####################################[ git_duet: current author+committer ]#################################### + # Current pair color + typeset -g POWERLEVEL9K_GIT_DUET_FOREGROUND=15 + # Example of a user-defined prompt segment. Function prompt_example will be called on every # prompt if `example` prompt segment is added to POWERLEVEL9K_LEFT_PROMPT_ELEMENTS or # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS. It displays an icon and orange text greeting the user. diff --git a/config/p10k-lean-8colors.zsh b/config/p10k-lean-8colors.zsh index c70ca45e..d6c3fc29 100644 --- a/config/p10k-lean-8colors.zsh +++ b/config/p10k-lean-8colors.zsh @@ -89,6 +89,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # git_duet # git duet (https://github.com/git-duet/git-duet) # time # current time # =========================[ Line #2 ]========================= newline # \n diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 643cf469..25dde5f3 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -89,6 +89,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # git_duet # git duet (https://github.com/git-duet/git-duet) # time # current time # =========================[ Line #2 ]========================= newline diff --git a/config/p10k-rainbow.zsh b/config/p10k-rainbow.zsh index 3377b8b9..fa6a1fb7 100644 --- a/config/p10k-rainbow.zsh +++ b/config/p10k-rainbow.zsh @@ -90,6 +90,7 @@ todo # todo items (https://github.com/todotxt/todo.txt-cli) timewarrior # timewarrior tracking status (https://timewarrior.net/) taskwarrior # taskwarrior task count (https://taskwarrior.org/) + # git_duet # git duet (https://github.com/git-duet/git-duet) # time # current time # =========================[ Line #2 ]========================= newline diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 22249727..5e3f9bf1 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3958,6 +3958,16 @@ prompt_vcs() { fi } +################################################################ +# Git-duet: Support for committer/author pair in git +# see: https://github.com/git-duet/git-duet +function prompt_git_duet() { + GIT_DUET_INITIALS=$(echo $(git config --get-regexp "^duet.env.git-.*-initials" 2>/dev/null | sed -e 's/^.*-initials //') | sed -e 's/ /+/') + if [[ ! -z "$GIT_DUET_INITIALS" ]]; then + _p9k_prompt_segment $0 magenta white '' 0 '' "$GIT_DUET_INITIALS" + fi +} + ################################################################ # Vi Mode: show editing mode (NORMAL|INSERT|VISUAL) prompt_vi_mode() {