Skip to content

Instantly share code, notes, and snippets.

@8spw
Last active November 18, 2025 12:28
Show Gist options
  • Select an option

  • Save 8spw/19ac201c7b6cd2939d8c44a1b2b9201f to your computer and use it in GitHub Desktop.

Select an option

Save 8spw/19ac201c7b6cd2939d8c44a1b2b9201f to your computer and use it in GitHub Desktop.
my over written theme of robbyrussell zsh
# --- True git counters (these always work) ---
git_count_staged() {
git diff --cached --name-only 2>/dev/null | wc -l | tr -d ' '
}
git_count_unstaged() {
git diff --name-only 2>/dev/null | wc -l | tr -d ' '
}
git_count_untracked() {
git ls-files --others --exclude-standard 2>/dev/null | wc -l | tr -d ' '
}
git_count_ahead() {
git rev-list --count @{u}..HEAD 2>/dev/null | tr -d ' '
}
git_count_behind() {
git rev-list --count HEAD..@{u} 2>/dev/null | tr -d ' '
}
PURPLE=%{%F{#fbdeff}%}
CYAN=%{%F{#8cfbff}%}
GREEN=%{%F{#9fff8c}%}
RED=%{%F{#ff7a99}%}
BLUE=%{%F{#8c87e6}%}
YELLO=%{%F{#fffcc4}%}
ORANGE=%{%F{#ffc68a}%}
GRAY=%{%F{#949494}%}
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%c%{$reset_color%}"
PROMPT+='$(git_prompt_info)'
PROMPT+=' '
# Colors:
ZSH_THEME_GIT_PROMPT_PREFIX="${BLUE}:(${PURPLE}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$BLUE%}) %{$fg[yellow]%}%1{%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$BLUE%})"
PROMPT+='$( [[ $(git_count_staged) -gt 0 ]] && echo "${YELLO}+$(git_count_staged)%{$reset_color%}" )'
# unstaged
PROMPT+='$( [[ $(git_count_unstaged) -gt 0 ]] && echo "${GRAY}?$(git_count_unstaged)%{$reset_color%}" )'
# untracked
PROMPT+='$( [[ $(git_count_untracked) -gt 0 ]] && echo "${ORANGE}*$(git_count_untracked)%{$reset_color%}" )'
# ahead
PROMPT+='$( [[ $(git_count_ahead) -gt 0 ]] && echo "${GREEN}@$(git_count_ahead)%{$reset_color%}" )'
# behind
PROMPT+='$( [[ $(git_count_behind) -gt 0 ]] && echo "${GRAY}>$(git_count_behind)%{$reset_color%}" )'
PROMPT+=' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment