Skip to content

Instantly share code, notes, and snippets.

@jhonoryza
Created August 27, 2021 14:42
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 jhonoryza/667df01400d0e86956f88cea7895d956 to your computer and use it in GitHub Desktop.
Save jhonoryza/667df01400d0e86956f88cea7895d956 to your computer and use it in GitHub Desktop.
show branch and color in zsh terminal

add these to show branch and color in zsh terminal

function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
setopt PROMPT_SUBST
NEWLINE=$'\n'
export PROMPT="%F{grey}%n%f %F{cyan}%~%f %F{green}$(parse_git_branch)%f ${NEWLINE} %F{normal}$%f "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment