2011-06-21 11:09:57 +02:00
|
|
|
|
# Based on bira theme
|
|
|
|
|
|
|
|
|
|
setopt prompt_subst
|
|
|
|
|
|
2015-07-01 16:33:08 +02:00
|
|
|
|
() {
|
|
|
|
|
|
|
|
|
|
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
|
2011-06-21 11:09:57 +02:00
|
|
|
|
|
|
|
|
|
# Check the UID
|
2014-06-02 12:42:21 +02:00
|
|
|
|
if [[ $UID -ne 0 ]]; then # normal user
|
2015-07-01 16:33:08 +02:00
|
|
|
|
PR_USER='%F{green}%n%f'
|
|
|
|
|
PR_USER_OP='%F{green}%#%f'
|
|
|
|
|
PR_PROMPT='%f➤ %f'
|
2014-06-02 12:42:21 +02:00
|
|
|
|
else # root
|
2015-07-01 16:33:08 +02:00
|
|
|
|
PR_USER='%F{red}%n%f'
|
|
|
|
|
PR_USER_OP='%F{red}%#%f'
|
|
|
|
|
PR_PROMPT='%F{red}➤ %f'
|
2011-06-21 11:09:57 +02:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if we are on SSH or not
|
2012-03-07 01:31:03 +01:00
|
|
|
|
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
2015-07-01 16:33:08 +02:00
|
|
|
|
PR_HOST='%F{red}%M%f' # SSH
|
2011-06-21 11:09:57 +02:00
|
|
|
|
else
|
2023-10-14 00:38:13 +02:00
|
|
|
|
PR_HOST='%F{green}%m%f' # no SSH
|
2011-06-21 11:09:57 +02:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2015-07-01 16:33:08 +02:00
|
|
|
|
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)'
|
2024-09-18 20:42:18 +02:00
|
|
|
|
local venv_prompt='$(virtualenv_prompt_info)'
|
2011-06-21 11:09:57 +02:00
|
|
|
|
|
2024-09-18 20:42:18 +02:00
|
|
|
|
PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
2011-06-21 11:09:57 +02:00
|
|
|
|
╰─$PR_PROMPT "
|
2015-07-01 16:33:08 +02:00
|
|
|
|
RPROMPT="${return_code}"
|
|
|
|
|
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
|
|
|
|
|
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
2015-11-06 23:20:11 +01:00
|
|
|
|
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
|
|
|
|
|
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
|
2024-09-18 20:42:18 +02:00
|
|
|
|
ZSH_THEME_VIRTUALENV_PREFIX="%F{red}("
|
|
|
|
|
ZSH_THEME_VIRTUALENV_SUFFIX=")%f "
|
2011-06-21 11:09:57 +02:00
|
|
|
|
|
2015-07-01 16:33:08 +02:00
|
|
|
|
}
|