Vagrant/config/ehlxr2.zsh-theme

54 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2018-11-14 02:39:39 +00:00
# Based on gnzh theme
2018-11-13 10:58:18 +00:00
setopt prompt_subst
() {
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
PR_USER='%F{green}%n%f'
PR_USER_OP='%F{green}%#%f'
else # root
2018-11-14 02:39:39 +00:00
PR_USER='%F{red}%n%f'
PR_USER_OP='%F{red}%#%f'
2018-11-13 10:58:18 +00:00
fi
2018-11-14 02:39:39 +00:00
# PR_PROMPT='%f> %f'
PR_PROMPT='%(?,%{$fg[green]%},%{$fg[red]%})> %{$reset_color%}'
2018-11-13 10:58:18 +00:00
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
2018-11-14 02:39:39 +00:00
PR_HOST='%F{yellow}%M%f' # SSH
2018-11-13 10:58:18 +00:00
else
2018-11-14 02:39:39 +00:00
PR_HOST='%F{cyan}%M%f' # no SSH
2018-11-13 10:58:18 +00:00
fi
local return_code="%(?..%F{red}%? ↵%f)"
2018-11-14 02:39:39 +00:00
local user_host="${PR_USER}%F{white}@${PR_HOST}"
2018-11-13 10:58:18 +00:00
local current_dir="%B%F{blue}%~%f%b"
local rvm_ruby=''
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'
fi
local git_branch='$(git_prompt_info)'
2018-11-14 02:39:39 +00:00
PROMPT="%F{white}╭─ ${user_host} ${current_dir} ${git_branch} ${rvm_ruby}
%F{white}╰─$PR_PROMPT"
RPROMPT="${return_code} [%D{%H:%M:%S}]"
2018-11-13 10:58:18 +00:00
ZSH_THEME_GIT_PROMPT_PREFIX="%F{green}("
#ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%F{green})"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x"
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o"
}