zgen.zsh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # guard against no zgen installed
  2. if [ ! -d "${HOME}/.zgen" ]; then
  3. echo "zgen not installed"
  4. return
  5. fi
  6. # load zgen
  7. source "${HOME}/.zgen/zgen.zsh"
  8. # if the init scipt doesn't exist
  9. if ! zgen saved; then
  10. # completions
  11. zgen load zsh-users/zsh-completions src
  12. # bulk load
  13. zgen loadall <<EOPLUGINS
  14. mreinhardt/sfz-prompt.zsh
  15. zsh-users/zsh-autosuggestions
  16. lukechilds/zsh-better-npm-completion
  17. zsh-users/zsh-syntax-highlighting
  18. zsh-users/zsh-history-substring-search
  19. EOPLUGINS
  20. # ^ can't indent this EOPLUGINS
  21. # save all to init script
  22. zgen save
  23. fi
  24. # customise sfz-prompt
  25. PROMPT_SFZ_CHAR="›"
  26. setopt TRANSIENT_RPROMPT
  27. prompt_sfz_colors () {
  28. case $1 in
  29. grey) echo "{234}";;
  30. # used for pwd, light blue
  31. bgrey) echo "{045}";;
  32. red) echo "{126}";;
  33. bred) echo "{200}";;
  34. green) echo "{035}";;
  35. bgreen) echo "{048}";;
  36. yellow) echo "{148}";;
  37. byellow) echo "{190}";;
  38. # used for prompt character, light grey
  39. blue) echo "{250}";;
  40. bblue) echo "{069}";;
  41. magenta) echo "{092}";;
  42. bmagenta) echo "{099}";;
  43. cyan) echo "{074}";;
  44. bcyan) echo "{081}";;
  45. white) echo "{153}";;
  46. bwhite) echo "{195}";;
  47. esac
  48. }
  49. prompt_sfz_git_dirty() {
  50. # too expensive
  51. }
  52. # bind to zsh-history-substring-search
  53. bindkey '^[[A' history-substring-search-up
  54. bindkey '^[[B' history-substring-search-down
  55. # customize zsh-autosuggestions
  56. ZSH_AUTOSUGGEST_USE_ASYNC="true"
  57. ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE="60"
  58. # customise zsh-history-substring-search
  59. HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="underline"
  60. HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND="none"
  61. # customise zsh-syntax-highlighting
  62. ZSH_HIGHLIGHT_STYLES[unknown-token]='none'
  63. ZSH_HIGHLIGHT_STYLES[path]='bold'
  64. ZSH_HIGHLIGHT_STYLES[builtin]='fg=82'
  65. ZSH_HIGHLIGHT_STYLES[command]='fg=121'
  66. ZSH_HIGHLIGHT_STYLES[alias]='fg=193'
  67. ZSH_HIGHLIGHT_STYLES[globbing]='fg=white'