Skip to content

Instantly share code, notes, and snippets.

@coshx
Created September 23, 2010 19:01
Show Gist options
  • Save coshx/594148 to your computer and use it in GitHub Desktop.
Save coshx/594148 to your computer and use it in GitHub Desktop.
# for .zshrc git branch
autoload -U colors && colors
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
setPrompt() {
PS1="%{$fg[cyan]%}%n%{$fg[magenta]%}@%{$fg[red]%}%m%{$fg[cyan]%}$(parse_git_branch)%{$fg[magenta]%}%#%{$reset_color%} "
RPS1="%{$fg[magenta]%}%~%{$reset_color%}"
}
precmd() {
setPrompt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment