1
0

zgen.zsh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. zdharma/history-search-multi-word
  19. zsh-users/zsh-history-substring-search
  20. buonomo/yarn-completion
  21. EOPLUGINS
  22. # ^ can't indent this EOPLUGINS
  23. # save all to init script
  24. zgen save
  25. fi
  26. # customise sfz-prompt
  27. PROMPT_SFZ_CHAR="›"
  28. setopt TRANSIENT_RPROMPT
  29. prompt_sfz_colors () {
  30. case $1 in
  31. grey) echo "{234}";;
  32. # used for pwd, light blue
  33. bgrey) echo "{045}";;
  34. red) echo "{126}";;
  35. bred) echo "{200}";;
  36. green) echo "{035}";;
  37. bgreen) echo "{048}";;
  38. yellow) echo "{148}";;
  39. byellow) echo "{190}";;
  40. # used for prompt character, light grey
  41. blue) echo "{250}";;
  42. bblue) echo "{069}";;
  43. magenta) echo "{092}";;
  44. bmagenta) echo "{099}";;
  45. cyan) echo "{074}";;
  46. bcyan) echo "{081}";;
  47. white) echo "{153}";;
  48. bwhite) echo "{195}";;
  49. esac
  50. }
  51. # prompt_sfz_git_dirty() {
  52. # # too expensive
  53. # }
  54. # bind to zsh-history-substring-search
  55. bindkey '^[[A' history-substring-search-up
  56. bindkey '^[[B' history-substring-search-down
  57. # customize zsh-autosuggestions
  58. ZSH_AUTOSUGGEST_USE_ASYNC="true"
  59. ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE="60"
  60. # customise zsh-history-substring-search
  61. HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="underline"
  62. HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND="none"
  63. HISTORY_SUBSTRING_SEARCH_FUZZY="yes"
  64. # customise zsh-syntax-highlighting
  65. ZSH_HIGHLIGHT_STYLES[unknown-token]='none'
  66. ZSH_HIGHLIGHT_STYLES[path]='bold'
  67. ZSH_HIGHLIGHT_STYLES[builtin]='fg=82'
  68. ZSH_HIGHLIGHT_STYLES[command]='fg=121'
  69. ZSH_HIGHLIGHT_STYLES[alias]='fg=193'
  70. ZSH_HIGHLIGHT_STYLES[globbing]='fg=white'