my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.9 KiB

3 years ago
  1. #!/usr/bin/env zsh
  2. # ------------------------------------------------------------------------------
  3. # FILE: emotty.zsh-theme
  4. # DESCRIPTION: A varying emoji based theme
  5. # AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
  6. # VERSION: 1.0.0
  7. # DEPENDS: emotty plugin
  8. # RECOMMENDS: Hasklig font
  9. #
  10. # This theme shows a different emoji for each tty at the main prompt.
  11. #
  12. # There are pre-defined different emoji sets to choose from, e.g.:
  13. # emoji, stellar, floral, zodiac, love (see emotty plugin).
  14. #
  15. # To choose a different emotty set than the default (emoji)
  16. # % export emotty_set=nature
  17. #
  18. # For the superuser (root) this theme shows a designated indicator
  19. # and switches the foreground color to red
  20. # (see root_prompt variable, default: skull).
  21. # But you are using sudo (8) instead of designated a root shell, right‽
  22. #
  23. # When logged in via SSH the main prompt also shows the user- and hostname.
  24. #
  25. # The exit status of the last failed command is displayed in the window title
  26. # along with an indicator (see warn_glyph variable, default: collision symbol).
  27. # To clear it just run: $NULL, true or :
  28. #
  29. # The right prompt shows the current working directory (3 levels up) in cyan.
  30. #
  31. # When in a git repository the main prompt shows the current branch name
  32. # with a branch indicator in yellow
  33. # (see vcs_branch_glyph variable, default: Hasklig branch glyph).
  34. #
  35. # If there are modified files the prompt switches to red and shows an unstaged
  36. # indicator (see vcs_unstaged_glyph variable, default: circled letter M).
  37. #
  38. # If there are staged files the prompt switches to green and shows an staged
  39. # indicator (see vcs_staged_glyph variable, default: high voltage sign).
  40. #
  41. # In a git repository the right prompt shows the repository name in bold and
  42. # prepends the current working directory subpath within the repository.
  43. #
  44. # When git currently performs an action such as merge or rebase, the action is
  45. # displayed in red instead of the branch name and a special action indicator
  46. # is shown (see vcs_action_glyph variable, default: chevron).
  47. # ------------------------------------------------------------------------------
  48. user_prompt="$(emotty)"
  49. root_prompt="$emoji[skull]"
  50. warn_prompt="$emoji[collision_symbol]"
  51. vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}"
  52. vcs_staged_glyph="%{$emoji[high_voltage_sign]%2G%}"
  53. vcs_branch_glyph=$'\Ue0a0' # 
  54. vcs_action_glyph=$'\U276f' # ❯
  55. red="$FG[001]"
  56. yellow="$FG[003]"
  57. green="$FG[002]"
  58. cyan="$FG[014]"
  59. prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}"
  60. # Uncomment the next line if you also like to see the warn_prompt in the prompt on the right.
  61. #last_command_failed="%(?.. %F{red}%1{${warn_prompt} %1G%}%?%f)"
  62. setopt promptsubst
  63. # Workaround for zsh 5.2 release (kudos to @timothybasanov)
  64. autoload +X VCS_INFO_nvcsformats
  65. functions[VCS_INFO_nvcsformats]=${functions[VCS_INFO_nvcsformats]/local -a msgs/}
  66. autoload -U add-zsh-hook
  67. autoload -Uz vcs_info
  68. zstyle ':vcs_info:*' enable git #hg svn cvs
  69. zstyle ':vcs_info:*' get-revision false
  70. zstyle ':vcs_info:*' check-for-changes true
  71. zstyle ':vcs_info:git:*' unstagedstr "${red}${vcs_unstaged_glyph}"
  72. zstyle ':vcs_info:*' stagedstr "${green}${vcs_staged_glyph}"
  73. # %(K|F){color} set (back|fore)ground color
  74. # %(k|f) reset (back|fore)ground color
  75. zstyle ':vcs_info:*' max-exports 3
  76. zstyle ':vcs_info:*' nvcsformats "${prompt_glyph}" '%3~' ''
  77. zstyle ':vcs_info:*' formats "${yellow}%u%c%b${vcs_branch_glyph}%f" '%S|' "$FX[bold]%r$FX[no-bold]"
  78. zstyle ':vcs_info:*' actionformats "${red}%K{white}%a${vcs_action_glyph}%k%f" '%S|' "$FX[bold]%r$FX[no-bold]"
  79. red_if_root="%(!.%F{red}.)"
  80. sshuser_on_host="${SSH_TTY:+%(!.$red.$yellow)%n@%m$reset_color}"
  81. PROMPT='${sshuser_on_host}${vcs_info_msg_0_}${red_if_root} '
  82. RPROMPT='${cyan}${vcs_info_msg_1_##.|}${vcs_info_msg_2_}%f${last_command_failed}'
  83. emotty_title() {
  84. title "${${?/[^0]*/$warn_prompt $?}/0/${prompt_glyph}}"
  85. }
  86. add-zsh-hook precmd emotty_title
  87. add-zsh-hook precmd vcs_info
  88. # vim:ft=zsh ts=2 sw=2 sts=2