Created
October 23, 2012 00:01
-
-
Save dnch/3935667 to your computer and use it in GitHub Desktop.
My ZSH theme
This file contains hidden or 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
ZSH_THEME_GIT_PROMPT_PREFIX="" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="" | |
ZSH_THEME_GIT_PROMPT_CLEAN=" %F{46}±" | |
ZSH_THEME_GIT_PROMPT_DIRTY=" %F{196}±" | |
function codeape_prompt { | |
# set up the biggest possible middle padding we'd need | |
(( spare_width = ${COLUMNS} )) | |
prompt=" " | |
# %{$fg_bold[yellow]%} | |
# %{$reset_colour%} | |
# get our components prepared | |
pr_hostname="${HOST%.*}" | |
pr_user_path="${USER}: ${PWD/${HOME}/~}" | |
pr_git="no repo" | |
cr_git="%F{238}" | |
current_ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) | |
pr_rvm="system ruby" | |
cr_rvm="%F{238}" | |
EXTRA_PADDING=10 | |
# pull in the values from system | |
if [[ -n $(git_prompt_info) ]]; then | |
pr_git="$(git_prompt_info)" | |
cr_git="%F{220}" | |
if [[ -n $(git status -s 2> /dev/null) ]]; then | |
EXTRA_PADDING=3 | |
else | |
EXTRA_PADDING=4 | |
fi | |
fi | |
if [[ -n $current_ruby_version ]]; then | |
pr_rvm=$current_ruby_version | |
cr_rvm="%F{67}" | |
fi | |
# shrink our padding | |
(( spare_width = $spare_width - 13 - ${#pr_hostname} - ${#pr_user_path} - ${#pr_git} - ${#pr_rvm} - $EXTRA_PADDING)) | |
while [ ${#prompt} -lt $spare_width ]; do | |
prompt=" $prompt" | |
done | |
prompt="%F{238}[ %F{244}%* | ${pr_hostname}%F{238} ]%F{231} ${pr_user_path}${prompt}%F{238}[ ${cr_git}${pr_git} %F{238}| ${cr_rvm}${pr_rvm} %F{238}]%F{231}" | |
echo $prompt | |
} | |
setopt prompt_subst | |
PROMPT=' | |
$(codeape_prompt) | |
> ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment