Skip to content

Instantly share code, notes, and snippets.

@fariswd
Created August 13, 2023 07:15
Show Gist options
  • Save fariswd/16cf4e91e1a3013dc67ba0ea96ef39b9 to your computer and use it in GitHub Desktop.
Save fariswd/16cf4e91e1a3013dc67ba0ea96ef39b9 to your computer and use it in GitHub Desktop.
# Load version control information
autoload -Uz git_branch_test_color
git_branch_test_color() {
local ref=$(git symbolic-ref --short HEAD 2> /dev/null)
if [ -n "${ref}" ]; then
local gitstatuscolor='%F{yellow}'
echo "%B${gitstatuscolor} (${ref})%b"
else
echo ""
fi
}
setopt PROMPT_SUBST
PROMPT='%F{green}%n/> %1d$(git_branch_test_color)%F{none} $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment