ohmyzsh/themes/gnzh.zsh-theme

47 lines
1.0 KiB
Plaintext
Raw Normal View History

2011-06-21 17:09:57 +08:00
# Based on bira theme
setopt prompt_subst
() {
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
2011-06-21 17:09:57 +08:00
# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
PR_USER='%F{green}%n%f'
PR_USER_OP='%F{green}%#%f'
PR_PROMPT='%f➤ %f'
else # root
PR_USER='%F{red}%n%f'
PR_USER_OP='%F{red}%#%f'
PR_PROMPT='%F{red}➤ %f'
2011-06-21 17:09:57 +08:00
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
PR_HOST='%F{red}%M%f' # SSH
2011-06-21 17:09:57 +08:00
else
PR_HOST='%F{green}%m%f' # no SSH
2011-06-21 17:09:57 +08:00
fi
local return_code="%(?..%F{red}%? ↵%f)"
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
local current_dir="%B%F{blue}%~%f%b"
local git_branch='$(git_prompt_info)'
local venv_prompt='$(virtualenv_prompt_info)'
2011-06-21 17:09:57 +08:00
PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
2011-06-21 17:09:57 +08:00
╰─$PR_PROMPT "
RPROMPT="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}"
ZSH_THEME_GIT_PROMPT_SUFFIX=" %f"
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}"
ZSH_THEME_RUBY_PROMPT_SUFFIX="%f"
ZSH_THEME_VIRTUALENV_PREFIX="%F{red}("
ZSH_THEME_VIRTUALENV_SUFFIX=")%f "
2011-06-21 17:09:57 +08:00
}