Skip to content

Instantly share code, notes, and snippets.

@rockkhuya
Created January 22, 2014 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rockkhuya/8554724 to your computer and use it in GitHub Desktop.
Save rockkhuya/8554724 to your computer and use it in GitHub Desktop.
OH-MY-ZSH git-flow theme
# Created by Luu Tuan Anh, OKWave Inc.
function git_prompt_info_short() {
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
ref="${ref#refs/heads/}"
if echo "$ref" | egrep "feature" > /dev/null; then
ref="f/${ref#feature/}"
fi
if echo "$ref" | egrep "release" > /dev/null; then
ref="r/${ref#release/}"
fi
if echo "$ref" | egrep "hotfix" > /dev/null; then
ref="h/${ref#hotfix/}"
fi
if echo "$ref" | egrep "support" > /dev/null; then
ref="s/${ref#support/}"
fi
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info_short)%{$fg[cyan]%}%{$reset_color%}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment