Skip to content

Instantly share code, notes, and snippets.

@njgibbon
Last active August 9, 2020 17:31
Show Gist options
  • Save njgibbon/e21bf8e857135571ccfe8edab8d81d34 to your computer and use it in GitHub Desktop.
Save njgibbon/e21bf8e857135571ccfe8edab8d81d34 to your computer and use it in GitHub Desktop.
Minimal .zshrc to output git branch name in prompt using vcs_info.
# ~/.zshrc
# Enabling and setting git info var to be used in prompt config.
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
# This line obtains information from the vcs.
zstyle ':vcs_info:git*' formats "- (%b) "
precmd() {
vcs_info
}
# Enable substitution in the prompt.
setopt prompt_subst
# Config for the prompt. PS1 synonym.
prompt='%2/ ${vcs_info_msg_0_}> '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment