prompt_minimal_setup 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #
  2. # A monochrome theme that displays basic information.
  3. #
  4. # Authors:
  5. # Brian Tse <briankftse@gmail.com>
  6. # Sorin Ionescu <sorin.ionescu@gmail.com>
  7. #
  8. # Screenshots:
  9. # http://i.imgur.com/zLZNK.png
  10. #
  11. function +vi-git_status {
  12. # Check for untracked files or updated submodules since vcs_info does not.
  13. if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
  14. hook_com[unstaged]='%F{red}●%f'
  15. fi
  16. }
  17. function prompt_minimal_precmd {
  18. vcs_info
  19. }
  20. function prompt_minimal_setup {
  21. setopt LOCAL_OPTIONS
  22. unsetopt XTRACE KSH_ARRAYS
  23. prompt_opts=(cr percent sp subst)
  24. # Load required functions.
  25. autoload -Uz add-zsh-hook
  26. autoload -Uz vcs_info
  27. # Add hook for calling vcs_info before each command.
  28. add-zsh-hook precmd prompt_minimal_precmd
  29. # Tell prezto we can manage this prompt
  30. zstyle ':prezto:module:prompt' managed 'yes'
  31. # Set vcs_info parameters.
  32. zstyle ':vcs_info:*' enable bzr git hg svn
  33. zstyle ':vcs_info:*' check-for-changes true
  34. zstyle ':vcs_info:*' stagedstr '%F{green}●%f'
  35. zstyle ':vcs_info:*' unstagedstr '%F{yellow}●%f'
  36. zstyle ':vcs_info:*' formats ' - [%b%c%u]'
  37. zstyle ':vcs_info:*' actionformats " - [%b%c%u|%F{cyan}%a%f]"
  38. zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b|%F{cyan}%r%f'
  39. zstyle ':vcs_info:git*+set-message:*' hooks git_status
  40. # Define prompts.
  41. PROMPT='%2~${vcs_info_msg_0_} » '
  42. RPROMPT=''
  43. }
  44. function prompt_minimal_preview {
  45. local +h PROMPT=''
  46. local +h RPROMPT=''
  47. local +h SPROMPT=''
  48. editor-info 2> /dev/null
  49. prompt_preview_theme 'minimal'
  50. }
  51. prompt_minimal_setup "$@"
  52. # vim: ft=zsh