Skip to content

Instantly share code, notes, and snippets.

@CDRussell
CDRussell / .zshrc
Last active December 22, 2021 11:28
# Git branch in command prompts
autoload -Uz vcs_info
precmd() {vcs_info}
setopt PROMPT_SUBST
# the last part of this command dictates what is shown for git info, referenced later by the prompt command.
# here, showing branch name %b in color 38 (blue) and the repo name %r in color 226 (yellow)
zstyle ':vcs_info:git:*' formats '%F{38}%b%f %F{226}(%r)%f'
# can set both the left (PROMPT) and right (RPROMPT) prompts