Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 55 lines (46 sloc) 1.811 kb
7a89786 @Gonzih oops, restore broken theme preview
Gonzih authored
1 # ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
929c64e @Gonzih Create gnzh theme
Gonzih authored
2 # Based on bira theme
3
4 # load some modules
5 autoload -U colors zsh/terminfo # Used in the colour alias below
6 colors
7 setopt prompt_subst
8
9 # make some aliases for the colours: (coud use normal escap.seq's too)
10 for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
11 eval PR_$color='%{$fg[${(L)color}]%}'
12 done
13 eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
14 eval PR_BOLD="%{$terminfo[bold]%}"
15
16 # Check the UID
17 if [[ $UID -ge 1000 ]]; then # normal user
18 eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
19 eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
20 local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR'
21 elif [[ $UID -eq 0 ]]; then # root
22 eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
23 eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
24 local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR'
25 fi
26
27 # Check if we are on SSH or not
28 if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
29 eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
30 else
31 eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
32 fi
33
34 local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
35
36 local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
37 local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
4dc11fe @Gonzih detect rvm or rbenv and show ruby version
Gonzih authored
38 local rvm_ruby=''
39 if which rvm-prompt &> /dev/null; then
40 rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
41 else
42 if which rbenv &> /dev/null; then
43 rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
44 fi
45 fi
929c64e @Gonzih Create gnzh theme
Gonzih authored
46 local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
47
4dc11fe @Gonzih detect rvm or rbenv and show ruby version
Gonzih authored
48 #PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
929c64e @Gonzih Create gnzh theme
Gonzih authored
49 PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
50 ╰─$PR_PROMPT "
51 RPS1="${return_code}"
52
53 ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹"
54 ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}"
Something went wrong with that request. Please try again.