Created
April 11, 2022 03:29
-
-
Save phuochau/2b761ee84ff019674188143dcc13a293 to your computer and use it in GitHub Desktop.
Show Git branch in zsh (insert it into ~/.zshrc on Mac)
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 version control information | |
autoload -Uz vcs_info | |
precmd() { vcs_info } | |
COLOR_DEF=$'\e[0m' | |
COLOR_DIR=$'\e[38;5;197m' | |
COLOR_GIT=$'\e[38;5;39m' | |
# Format the vcs_info_msg_0_ variable | |
zstyle ':vcs_info:git:*' formats '| %b' | |
# Set up the prompt (with git branch name) | |
setopt PROMPT_SUBST | |
PROMPT='${COLOR_DIR}%~ ${COLOR_GIT}${vcs_info_msg_0_} ${COLOR_DEF}$ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment