ohmyzsh/themes/blinks.zsh-theme
Matt Sweeney 7f75b015e6 Add virtualenv plugin support to 'blinks' theme
If the plugin is not activated, degrade gracefully
2013-04-30 18:11:28 -07:00

40 lines
1.3 KiB
Bash

# https://github.com/blinks zsh theme
function _prompt_char() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
echo "%{%F{blue}%}±%{%f%k%b%}"
else
echo ' '
fi
}
# This theme works with both the "dark" and "light" variants of the
# Solarized color schema. Set the SOLARIZED_THEME variable to one of
# these two values to choose. If you don't specify, we'll assume you're
# using the "dark" variant.
case ${SOLARIZED_THEME:-dark} in
light) bkg=white;;
*) bkg=black;;
esac
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{${bkg}}%B%F{green}%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_VIRTUALENV_PROMPT_PREFIX=" (%{%B%F{blue}%}"
ZSH_THEME_VIRTUALENV_PROMPT_SUFFIX="%{%f%k%b%K{${bkg}}%B%F{green}%})"
function _virtualenv() {
# check if the virtualenv plugin is activated
if [[ ${plugins[(r)virtualenv]} == virtualenv ]] then;
echo "%s" $(virtualenv_prompt_info)
fi
}
PROMPT='%{%f%k%b%}
%{%K{${bkg}}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{${bkg}}%}%~%{%B%F{green}%}$(_virtualenv)$(git_prompt_info)%E%{%f%k%b%}
%{%K{${bkg}}%}$(_prompt_char)%{%K{${bkg}}%} %#%{%f%k%b%} '
RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}'