Created
September 29, 2016 07:41
-
-
Save zmalltalker/9e13f164030c6e04df866b4812f6575f to your computer and use it in GitHub Desktop.
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
# Interesting variables: | |
# - $COLUMNS: how wide are we? | |
# - $SECONDS: how long have we been running | |
# %#: root will have #, others will have % | |
autoload -U colors | |
setopt prompt_subst | |
# get the name of the branch we are on | |
function git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
} | |
parse_git_dirty () { | |
if [[ -n $(git status -s 2> /dev/null) ]]; then | |
echo "✗" | |
else | |
echo "" | |
fi | |
} | |
PS1="%F{red}%n%F{blue}(%F{red}%22<..<%4~%F{blue})%F{red}%F{blue}%f " | |
RPROMPT=$'%F{yellow}$(parse_git_dirty) %F{green}$(git_prompt_info)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment