gnzh.zsh-theme 937 Bytes
Newer Older
Max Gonzih's avatar
Max Gonzih committed
1
2
3
4
# Based on bira theme

setopt prompt_subst

5
6
7
() {

local PR_USER PR_USER_OP PR_PROMPT PR_HOST
Max Gonzih's avatar
Max Gonzih committed
8
9

# Check the UID
10
if [[ $UID -ne 0 ]]; then # normal user
11
12
13
  PR_USER='%F{green}%n%f'
  PR_USER_OP='%F{green}%#%f'
  PR_PROMPT='%f➤ %f'
14
else # root
15
16
17
  PR_USER='%F{red}%n%f'
  PR_USER_OP='%F{red}%#%f'
  PR_PROMPT='%F{red}➤ %f'
Max Gonzih's avatar
Max Gonzih committed
18
19
20
fi

# Check if we are on SSH or not
21
if [[ -n "$SSH_CLIENT"  ||  -n "$SSH2_CLIENT" ]]; then
22
  PR_HOST='%F{red}%M%f' # SSH
Max Gonzih's avatar
Max Gonzih committed
23
else
24
  PR_HOST='%F{green}%M%f' # no SSH
Max Gonzih's avatar
Max Gonzih committed
25
26
27
fi


28
29
30
31
32
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)'
Max Gonzih's avatar
Max Gonzih committed
33

34
PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
Max Gonzih's avatar
Max Gonzih committed
35
╰─$PR_PROMPT "
36
37
38
39
RPROMPT="${return_code}"

ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
40
41
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
Max Gonzih's avatar
Max Gonzih committed
42

43
}