Skip to content

Instantly share code, notes, and snippets.

@mike-weiner
Created May 21, 2022 00:27
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 mike-weiner/41ff1ac53c0eaf6497a7ac20d39d2e90 to your computer and use it in GitHub Desktop.
Save mike-weiner/41ff1ac53c0eaf6497a7ac20d39d2e90 to your computer and use it in GitHub Desktop.
Modifies the command line prompt to include Git repository information (if applicable).
# Modifies the Command Line Prompt to the following format:
# <Username> <Current Directory Name> <Current Git Branch Name (if applicable)> %
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats '(%b)'
git_prompt() {
if [ -z "${vcs_info_msg_0_}" ]
then
echo ""
else
echo "${vcs_info_msg_0_} "
fi
}
# Customize Prompt to Include Git Branch Name
setopt PROMPT_SUBST
export PROMPT='%n %F{197}%B%.%b%f %F{43}$(git_prompt)%f%# '
# CUSTOM DIRECTORY COLORS
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment