gnzh.zsh-theme 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Based on bira theme
  2. setopt prompt_subst
  3. () {
  4. local PR_USER PR_USER_OP PR_PROMPT PR_HOST
  5. # Check the UID
  6. if [[ $UID -ne 0 ]]; then # normal user
  7. PR_USER='%F{green}%n%f'
  8. PR_USER_OP='%F{green}%#%f'
  9. PR_PROMPT='%f➤ %f'
  10. else # root
  11. PR_USER='%F{red}%n%f'
  12. PR_USER_OP='%F{red}%#%f'
  13. PR_PROMPT='%F{red}➤ %f'
  14. fi
  15. # Check if we are on SSH or not
  16. if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
  17. PR_HOST='%F{red}%M%f' # SSH
  18. else
  19. PR_HOST='%F{green}%m%f' # no SSH
  20. fi
  21. local return_code="%(?..%F{red}%? ↵%f)"
  22. local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
  23. local current_dir="%B%F{blue}%~%f%b"
  24. local git_branch='$(git_prompt_info)'
  25. local venv_prompt='$(virtualenv_prompt_info)'
  26. PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
  27. ╰─$PR_PROMPT "
  28. RPROMPT="${return_code}"
  29. ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
  30. ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
  31. ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
  32. ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
  33. ZSH_THEME_VIRTUALENV_PREFIX="%F{red}("
  34. ZSH_THEME_VIRTUALENV_SUFFIX=")%f "
  35. }