zgen.zsh 1.9 KB

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