68b792bbb67958c726dd8ebe9cfe12f5e463d160

Author
Michele Bologna <michele.bologna@gmail.com>
Committer
Michele Bologna <michele.bologna@gmail.com>
Date

Message

Change to use omz git_prompt* functions

Removed references for official git __git_ps1() functions.
Change to use omz function git_prompt* functions like:
- git_prompt_info() -> branch name
- git_prompt_status() -> check if untracked, modified, added,
  stashed file are in the current git repo
- git_remote_status() -> check if current repo is ahead, behind,
  or diverged.
These functions returns string automatically added to your PS1;
these are customizable via exporting ZSH_THEME_GIT_PROMPT*

Diff

 1diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme
 2index fec2438734af2f0fcd5a03bd882ffce52598e471..110e3f203518c28ca6780d874c877b9ef8b2b62a 100644
 3--- a/themes/michelebologna.zsh-theme
 4+++ b/themes/michelebologna.zsh-theme
 5@@ -59,16 +59,17 @@ ZSH_THEME_GIT_PROMPT_PREFIX=""
 6 ZSH_THEME_GIT_PROMPT_SUFFIX=""
 7 ZSH_THEME_GIT_PROMPT_DIRTY=""
 8 ZSH_THEME_GIT_PROMPT_CLEAN=""
 9-ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
10-ZSH_THEME_GIT_PROMPT_MODIFIED="*"
11-ZSH_THEME_GIT_PROMPT_ADDED="+"
12-ZSH_THEME_GIT_PROMPT_STASHED="$"
13-ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="="
14+ZSH_THEME_GIT_PROMPT_UNTRACKED="$blue%%"
15+ZSH_THEME_GIT_PROMPT_MODIFIED="$red*"
16+ZSH_THEME_GIT_PROMPT_ADDED="$green+"
17+ZSH_THEME_GIT_PROMPT_STASHED="$blue$"
18+ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="$green="
19 ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
20 ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
21-ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
22+ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>"
23 
24 PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
25-PROMPT+='$(__git_ps1)'
26+GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)'
27+PROMPT+="$GIT_PROMPT"
28 PROMPT+=" $last_command_output%#$reset "
29 RPROMPT=''