Created
June 20, 2022 10:51
-
-
Save imnaveensharma/20a197b7f79254a34836cfdf5a213894 to your computer and use it in GitHub Desktop.
Git Branch Colors and Formatting on Terminal 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
# https://misc.flogisoft.com/bash/tip_colors_and_formatting | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' | |
} | |
COLOR_DEF='%f' | |
COLOR_USR='%F{0}' | |
COLOR_DIR='%F{197}' | |
COLOR_GIT='%F{39}' | |
NEWLINE=$'\n' | |
setopt PROMPT_SUBST | |
export PROMPT='${COLOR_USR}%M ${COLOR_DIR}%d ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF}${NEWLINE}%% ' | |
#export PROMPT='${COLOR_USR}%n@%M ${COLOR_DIR}%d ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF} $ ' | |
#export PROMPT='${COLOR_USR}%n@%M ${COLOR_DIR}%d ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF}${NEWLINE}%% ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment