Skip to content

Instantly share code, notes, and snippets.

View albertho206's full-sized avatar
👨‍💻
Studying

Albert Ho albertho206

👨‍💻
Studying
View GitHub Profile
@albertho206
albertho206 / mac-terminal-branch-color-zsh.md
Created March 9, 2024 21:53
Add branch and color to Mac terminal zsh in 2024
function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

COLOR_DEF=$'%f'
COLOR_USR=$'%F{243}'
COLOR_DIR=$'%F{197}'
COLOR_GIT=$'%F{39}'
setopt PROMPT_SUBST