Skip to content

Instantly share code, notes, and snippets.

@goodviber
Created December 15, 2022 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goodviber/f685a76112ae6821dae772a1ce8e17bf to your computer and use it in GitHub Desktop.
Save goodviber/f685a76112ae6821dae772a1ce8e17bf to your computer and use it in GitHub Desktop.
zsh git parser
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}'
NEWLINE=$'\n'
setopt PROMPT_SUBST
export PROMPT='${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