Skip to content
Newer
Older
100644 51 lines (39 sloc) 1.34 KB
7a89786 @Gonzih oops, restore broken theme preview
Gonzih authored Aug 13, 2011
1 # ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
2 # Based on bira theme
3
4 setopt prompt_subst
5
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
6 () {
7
8 local PR_USER PR_USER_OP PR_PROMPT PR_HOST
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
9
10 # Check the UID
fbf4a78 @mcornella Show user prompt in gnzh theme regardless of UID
mcornella authored Jun 2, 2014
11 if [[ $UID -ne 0 ]]; then # normal user
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
12 PR_USER='%F{green}%n%f'
13 PR_USER_OP='%F{green}%#%f'
14 PR_PROMPT='%f➤ %f'
fbf4a78 @mcornella Show user prompt in gnzh theme regardless of UID
mcornella authored Jun 2, 2014
15 else # root
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
16 PR_USER='%F{red}%n%f'
17 PR_USER_OP='%F{red}%#%f'
18 PR_PROMPT='%F{red}➤ %f'
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
19 fi
20
21 # Check if we are on SSH or not
4a88743 @wting fix gnzh theme to detect local rvm installations
wting authored Mar 6, 2012
22 if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
23 PR_HOST='%F{red}%M%f' # SSH
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
24 else
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
25 PR_HOST='%F{green}%M%f' # no SSH
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
26 fi
27
28
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
29 local return_code="%(?..%F{red}%? ↵%f)"
30
31 local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
32 local current_dir="%B%F{blue}%~%f%b"
4dc11fe @Gonzih detect rvm or rbenv and show ruby version
Gonzih authored Aug 13, 2011
33 local rvm_ruby=''
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
34 if ${HOME}/.rvm/bin/rvm-prompt &> /dev/null; then # detect user-local rvm installation
35 rvm_ruby='%F{red}‹$(${HOME}/.rvm/bin/rvm-prompt i v g s)›%f'
36 elif which rvm-prompt &> /dev/null; then # detect system-wide rvm installation
37 rvm_ruby='%F{red}‹$(rvm-prompt i v g s)›%f'
38 elif which rbenv &> /dev/null; then # detect Simple Ruby Version Management
39 rvm_ruby='%F{red}‹$(rbenv version | sed -e "s/ (set.*$//")›%f'
4dc11fe @Gonzih detect rvm or rbenv and show ruby version
Gonzih authored Aug 13, 2011
40 fi
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
41 local git_branch='$(git_prompt_info)'
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
42
43 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
44 ╰─$PR_PROMPT "
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
45 RPROMPT="${return_code}"
46
47 ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
48 ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
929c64e @Gonzih Create gnzh theme
Gonzih authored Jun 21, 2011
49
d009f24 @apjanke gnzh theme: fix "eval" and related problems.
apjanke authored Jul 1, 2015
50 }
Something went wrong with that request. Please try again.