Skip to content

Instantly share code, notes, and snippets.

@edwinwong90
Last active February 23, 2026 03:32
Show Gist options
  • Select an option

  • Save edwinwong90/4513ead4c81ca981c8d6f31b11341db2 to your computer and use it in GitHub Desktop.

Select an option

Save edwinwong90/4513ead4c81ca981c8d6f31b11341db2 to your computer and use it in GitHub Desktop.
Show Git branch [zsh]
# 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 "%F{green}(%b)%F{none} "
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