Skip to content

Instantly share code, notes, and snippets.

@necrophidia
Last active March 5, 2022 00:14
Show Gist options
  • Save necrophidia/d81301912279ce349b9e4ff4ebca5a25 to your computer and use it in GitHub Desktop.
Save necrophidia/d81301912279ce349b9e4ff4ebca5a25 to your computer and use it in GitHub Desktop.
Add colored Git Branch information to your ZSH PROMPT
# Load colors, auto-completion, and version control information
autoload -Uz compinit colors vcs_info
colors
compinit
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable, see https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg for color number (replace 039 with any number you wanted)
zstyle ':vcs_info:git:*' formats '[%F{039}%b%f]'
# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
PROMPT='%n ${PWD/#$HOME/~} ${vcs_info_msg_0_}> '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment