Last active
March 5, 2022 00:14
-
-
Save necrophidia/d81301912279ce349b9e4ff4ebca5a25 to your computer and use it in GitHub Desktop.
Add colored Git Branch information to your ZSH PROMPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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