-
Notifications
You must be signed in to change notification settings - Fork 12
/
blokkzh.zsh-theme
82 lines (71 loc) · 2.71 KB
/
blokkzh.zsh-theme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# ZSH Theme - Preview: https://raw.githubusercontent.com/KorvinSilver/blokkzh/master/preview.png
# Mod of the gnzh theme
setopt prompt_subst
(){
local PR_USER PR_USER_OP PR_PROMPT PR_HOST PR_AT
local userName hostName atSign promptSign
local returnSymbol promptSymbolFrom promptSymbolTo promptSymbol rvmSymbol
# Switch to ASCII characters in Linux term
if [[ ${TERM} == "linux" ]];
then
returnSymbol='<<'
promptSymbolFrom='/-'
promptSymbolTo='\-'
promptSymbol='>'
rvmSymbol='%F{red}rvm%f'
ZSH_THEME_GIT_PROMPT_PREFIX='-[%F{yellow}git '
ZSH_THEME_GIT_PROMPT_SUFFIX='%f]'
ZSH_THEME_VIRTUALENV_PREFIX='-[%F{green}python '
ZSH_THEME_VIRTUALENV_SUFFIX='%f]'
else
returnSymbol='↵'
promptSymbolFrom='┌─'
promptSymbolTo='└─'
promptSymbol='➤'
rvmSymbol='%F{red}🔻%f'
ZSH_THEME_GIT_PROMPT_PREFIX='─[%F{yellow} '
ZSH_THEME_GIT_PROMPT_SUFFIX='%f]'
ZSH_THEME_VIRTUALENV_PREFIX='─[%F{green}🐍 '
ZSH_THEME_VIRTUALENV_SUFFIX='%f]'
fi
# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
PR_USER='%F{yellow}%n%f'
PR_USER_OP='%F{yellow}%#%f'
PR_PROMPT="${promptSymbol}"
PR_AT='@'
else # root
PR_USER=''
PR_USER_OP=''
PR_PROMPT="%F{red}${promptSymbol}%f"
PR_AT=''
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
if [[ $UID -eq 0 ]]; then
PR_HOST='%B%F{magenta}%M%f%b' # SSH, root
else
PR_HOST='%F{green}%M%f' # SSH, normal user
fi
elif [[ $UID -eq 0 ]]; then
PR_HOST='%B%F{red}%M%f%b' # no SSH, root
else
PR_HOST='%F{cyan}%M%f' # no SSH, normal user
fi
local return_code="%(?..%F{red}%? ${returnSymbol}%f)"
local user_host="${PR_USER}${PR_AT}${PR_HOST}"
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='─['${rvmSymbol}' %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='─['${rvmSymbol}' %F{red}$(rvm-prompt i v g s)%f]'
elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
rvm_ruby='─['${rvmSymbol}' %F{red}$(rbenv version | sed -e "s/ (set.*$//")%f]'
fi
local git_branch='$(git_prompt_info)'
local venv_python='$(virtualenv_prompt_info)'
PROMPT="${promptSymbolFrom}[${user_host}]${rvm_ruby}${venv_python}─[${current_dir}]${git_branch}
${promptSymbolTo}$PR_PROMPT "
RPROMPT="${return_code}"
}