Update theme with rbenv support + cleanup

This commit is contained in:
Alexander Berezovsky 2015-08-30 23:28:19 -07:00
parent 135c3763cc
commit 98a3994eca

View File

@ -1,37 +1,28 @@
# fino-time.zsh-theme
# Use with a dark background and 256-color terminal!
# Meant for people with RVM and git. Tested only on OS X 10.7.
# You can set your computer name in the ~/.box-name file if you want.
# Borrowing shamelessly from these oh-my-zsh themes:
# bira
# robbyrussell
#
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
# fino
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '⠠⠵' && return
git branch >/dev/null 2>/dev/null && echo "⠵" && return
echo '○'
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
}
local ruby_env=''
if which rvm-prompt &> /dev/null; then
ruby_env=' $(rvm-prompt i v g)%{$reset_color%}'
else
if which rbenv &> /dev/null; then
ruby_env=' $(rbenv version-name)%{$reset_color%}'
fi
fi
local rvm_ruby='$(rvm-prompt i v g)%{$reset_color%}'
local current_dir='${PWD/#$HOME/~}'
local git_info='$(git_prompt_info)'
local prompt_char='$(prompt_char)'
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby} %D - %*
╰─$(virtualenv_info)$(prompt_char) "
PROMPT="╭─ %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} ${ruby_env} %*
╰─${prompt_char}%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"