Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save richardleandro1/697dbf73a0a8417764f9d6dd56227a47 to your computer and use it in GitHub Desktop.
Save richardleandro1/697dbf73a0a8417764f9d6dd56227a47 to your computer and use it in GitHub Desktop.
zsh branch
# > GIT BRANCH TERMINAL
function parse_git_branch() {
local branch
branch=$(git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/\1/p')
[[ -n $branch ]] && echo "[$branch]"
}
# blink on/off
BLINK_ON=$'%{\e[5m%}'
BLINK_OFF=$'%{\e[0m%}'
# cores
COLOR_USR=$'%F{243}'
COLOR_DIR=$'%F{197}'
COLOR_GIT_FG=$'%F{39}'
COLOR_DEF=$'%f%k'
setopt PROMPT_SUBST
export PROMPT="${COLOR_USR}%n ${COLOR_DIR}%~ ${COLOR_GIT_FG}${BLINK_ON}\$(parse_git_branch)${BLINK_OFF}${COLOR_DEF} $ "
# > END GIT TERMINAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment