Not for normies
| 1 | # Based on bira theme |
| 2 | |
| 3 | setopt prompt_subst |
| 4 | |
| 5 | () { |
| 6 | |
| 7 | local PR_USER PR_USER_OP PR_PROMPT PR_HOST |
| 8 | |
| 9 | # Check the UID |
| 10 | if [[ $UID -ne 0 ]]; then # normal user |
| 11 | PR_USER='%F{green}%n%f' |
| 12 | PR_USER_OP='%F{green}%#%f' |
| 13 | PR_PROMPT='%f➤ %f' |
| 14 | else # root |
| 15 | PR_USER='%F{red}%n%f' |
| 16 | PR_USER_OP='%F{red}%#%f' |
| 17 | PR_PROMPT='%F{red}➤ %f' |
| 18 | fi |
| 19 | |
| 20 | # 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 |
| 23 | else |
| 24 | PR_HOST='%F{green}%m%f' # no SSH |
| 25 | fi |
| 26 | |
| 27 | |
| 28 | local return_code="%(?..%F{red}%? ↵%f)" |
| 29 | |
| 30 | local user_host="${PR_USER}%F{cyan}@${PR_HOST}" |
| 31 | local current_dir="%B%F{blue}%~%f%b" |
| 32 | local git_branch='$(git_prompt_info)' |
| 33 | local venv_prompt='$(virtualenv_prompt_info)' |
| 34 | |
| 35 | PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch} |
| 36 | ╰─$PR_PROMPT " |
| 37 | RPROMPT="${return_code}" |
| 38 | |
| 39 | ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹" |
| 40 | ZSH_THEME_GIT_PROMPT_SUFFIX="› %f" |
| 41 | ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹" |
| 42 | ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f" |
| 43 | ZSH_THEME_VIRTUALENV_PREFIX="%F{red}(" |
| 44 | ZSH_THEME_VIRTUALENV_SUFFIX=")%f " |
| 45 | |
| 46 | } |