Created
May 21, 2022 00:27
-
-
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).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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