Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Use different branch colour per branch
Browse files Browse the repository at this point in the history
Cyan is used for the `master` branch and yellow is used for all other
branches.
  • Loading branch information
JamesLaverack committed Aug 13, 2017
1 parent b837bd9 commit 20eba44
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions bernkastel.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,34 @@

# VCS
YS_VCS_PROMPT_PREFIX1=" "
YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}"
YS_VCS_PROMPT_PREFIX2=":%{$fg[yellow]%}"
YS_VCS_PROMPT_PREFIX2_MASTER=":%{$fg[cyan]%}"
YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o"

# Git info
local git_info='$(git_prompt_info)'
local git_info='$(ys_git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}"
ZSH_THEME_GIT_PROMPT_PREFIX_MASTER="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2_MASTER}"
ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX"
ZSH_THEME_GIT_PROMPT_DIRTY="$YS_VCS_PROMPT_DIRTY"
ZSH_THEME_GIT_PROMPT_CLEAN="$YS_VCS_PROMPT_CLEAN"

# Git
ys_git_prompt_info() {
local ref
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
if [ "${ref#refs/heads/}" = 'master' ]; then
echo "$ZSH_THEME_GIT_PROMPT_PREFIX_MASTER${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
else
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
fi
}

# HG info
local hg_info='$(ys_hg_prompt_info)'
ys_hg_prompt_info() {
Expand Down

0 comments on commit 20eba44

Please sign in to comment.