Blame view
repos/robbyrussell/oh-my-zsh/themes/gnzh.zsh-theme
1.34 KB
|
093a6c34b
|
1 2 |
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png # Based on bira theme |
|
093a6c34b
|
3 |
setopt prompt_subst |
|
ed37aae5b
|
4 5 6 |
() {
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
|
|
093a6c34b
|
7 8 9 |
# Check the UID if [[ $UID -ne 0 ]]; then # normal user |
|
ed37aae5b
|
10 11 12 |
PR_USER='%F{green}%n%f'
PR_USER_OP='%F{green}%#%f'
PR_PROMPT='%f➤ %f'
|
|
093a6c34b
|
13 |
else # root |
|
ed37aae5b
|
14 15 16 |
PR_USER='%F{red}%n%f'
PR_USER_OP='%F{red}%#%f'
PR_PROMPT='%F{red}➤ %f'
|
|
093a6c34b
|
17 18 19 20 |
fi # Check if we are on SSH or not if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then |
|
ed37aae5b
|
21 |
PR_HOST='%F{red}%M%f' # SSH
|
|
093a6c34b
|
22 |
else |
|
ed37aae5b
|
23 |
PR_HOST='%F{green}%M%f' # no SSH
|
|
093a6c34b
|
24 |
fi |
|
093a6c34b
|
25 |
|
|
ed37aae5b
|
26 27 28 29 |
local return_code="%(?..%F{red}%? ↵%f)"
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
local current_dir="%B%F{blue}%~%f%b"
|
|
093a6c34b
|
30 |
local rvm_ruby='' |
|
ed37aae5b
|
31 32 33 34 35 36 |
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'
|
|
093a6c34b
|
37 |
fi |
|
ed37aae5b
|
38 |
local git_branch='$(git_prompt_info)' |
|
093a6c34b
|
39 |
|
|
093a6c34b
|
40 41 |
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─$PR_PROMPT "
|
|
ed37aae5b
|
42 43 44 45 |
RPROMPT="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
|
093a6c34b
|
46 |
|
|
ed37aae5b
|
47 |
} |