Skip to content

Instantly share code, notes, and snippets.

@kkdeok
Last active December 20, 2022 20:41
Show Gist options
  • Save kkdeok/c4fcd2e65c3397947248878065b644ed to your computer and use it in GitHub Desktop.
Save kkdeok/c4fcd2e65c3397947248878065b644ed to your computer and use it in GitHub Desktop.
Git Branch Terminal Prompt for zsh (MacOS Catalina)

Git Branch Terminal Prompt for zsh (MacOS Catalina)

sample image

function parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

setopt PROMPT_SUBST
export PROMPT='%{%F{245}%}%n %{%F{normal}%}%2~ %{%F{green}%}$(parse_git_branch) %{%F{normal}%}$%{%f%} '



reference: link

@neiloler
Copy link

Some how I missed all the notifications for the kind thanks here, thanks! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment