Skip to content

Instantly share code, notes, and snippets.

@iswanj
Created October 19, 2023 01:45
Show Gist options
  • Save iswanj/bd225e2620b6b819383ecfca6d29b28d to your computer and use it in GitHub Desktop.
Save iswanj/bd225e2620b6b819383ecfca6d29b28d to your computer and use it in GitHub Desktop.
parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
COLOR_DEF='%f'
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