2011-08-13 03:32:37 -07:00
|
|
|
|
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
|
2011-06-21 02:09:57 -07:00
|
|
|
|
# Based on bira theme
|
|
|
|
|
|
|
|
|
|
setopt prompt_subst
|
|
|
|
|
|
2015-07-01 07:33:08 -07:00
|
|
|
|
() {
|
|
|
|
|
|
|
|
|
|
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
|
2011-06-21 02:09:57 -07:00
|
|
|
|
|
|
|
|
|
# Check the UID
|
2014-06-02 03:42:21 -07:00
|
|
|
|
if [[ $UID -ne 0 ]]; then # normal user
|
2015-07-01 07:33:08 -07:00
|
|
|
|
PR_USER='%F{green}%n%f'
|
|
|
|
|
PR_USER_OP='%F{green}%#%f'
|
|
|
|
|
PR_PROMPT='%f➤ %f'
|
2014-06-02 03:42:21 -07:00
|
|
|
|
else # root
|
2015-07-01 07:33:08 -07:00
|
|
|
|
PR_USER='%F{red}%n%f'
|
|
|
|
|
PR_USER_OP='%F{red}%#%f'
|
|
|
|
|
PR_PROMPT='%F{red}➤ %f'
|
2011-06-21 02:09:57 -07:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if we are on SSH or not
|
2012-03-06 17:31:03 -07:00
|
|
|
|
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
2015-07-01 07:33:08 -07:00
|
|
|
|
PR_HOST='%F{red}%M%f' # SSH
|
2011-06-21 02:09:57 -07:00
|
|
|
|
else
|
2015-07-01 07:33:08 -07:00
|
|
|
|
PR_HOST='%F{green}%M%f' # no SSH
|
2011-06-21 02:09:57 -07:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2015-07-01 07:33:08 -07:00
|
|
|
|
local return_code="%(?..%F{red}%? ↵%f)"
|
|
|
|
|
|
|
|
|
|
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
|
|
|
|
|
local current_dir="%B%F{blue}%~%f%b"
|
2011-08-13 03:29:13 -07:00
|
|
|
|
local rvm_ruby=''
|
2015-07-01 07:33:08 -07:00
|
|
|
|
if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
|
|
|
|
|
rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
|
|
|
|
|
elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
|
|
|
|
|
rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
|
|
|
|
|
elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
|
|
|
|
|
rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
|
2011-08-13 03:29:13 -07:00
|
|
|
|
fi
|
2015-07-01 07:33:08 -07:00
|
|
|
|
local git_branch='$(git_prompt_info)'
|
2011-06-21 02:09:57 -07:00
|
|
|
|
|
|
|
|
|
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
|
|
|
|
╰─$PR_PROMPT "
|
2015-07-01 07:33:08 -07:00
|
|
|
|
RPROMPT="${return_code}"
|
|
|
|
|
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
2011-06-21 02:09:57 -07:00
|
|
|
|
|
2015-07-01 07:33:08 -07:00
|
|
|
|
}
|