neovim.nix 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. { lib
  2. , writeTextFile
  3. , neovim
  4. , fd
  5. , ripgrep
  6. , nodePackages
  7. , vimPlugins
  8. , withPlayground ? false
  9. }:
  10. let
  11. extra-treesitter-textobjects = writeTextFile {
  12. name = "extra-treesitter-textobjects";
  13. destination = "/after/queries/javascript/textobjects.scm";
  14. text = ''
  15. ; support swapping elements inside arrays too
  16. (array "," . (_) @parameter.inner)
  17. (array . (_) @parameter.inner ",")
  18. '';
  19. };
  20. extraPath = [
  21. fd
  22. ripgrep
  23. nodePackages.typescript-language-server
  24. nodePackages.eslint_d
  25. ];
  26. in
  27. neovim.override {
  28. extraMakeWrapperArgs = "--prefix PATH : ${lib.makeBinPath extraPath}";
  29. configure = {
  30. customRC = ''
  31. source ${./settings.lua}
  32. source ${./plugins.lua}
  33. source ${./mappings.lua}
  34. source ${./autocmd.lua}
  35. source ${./lsp.lua}
  36. source ${./theme.lua}
  37. '' + lib.optionalString withPlayground ''
  38. source ${./playground.lua}
  39. '';
  40. packages.myVimPackage = with vimPlugins; {
  41. start = [
  42. vim-sensible
  43. vim-sleuth
  44. vim-fugitive
  45. vim-rhubarb
  46. vim-surround
  47. vim-abolish
  48. undotree
  49. telescope-nvim
  50. telescope-fzf-native-nvim
  51. mini-nvim
  52. gitsigns-nvim
  53. sonokai
  54. (nvim-treesitter.withPlugins (p: with p; [
  55. tree-sitter-bash
  56. tree-sitter-css
  57. tree-sitter-go
  58. tree-sitter-javascript
  59. tree-sitter-json
  60. tree-sitter-lua
  61. tree-sitter-nix
  62. tree-sitter-ruby
  63. tree-sitter-tsx
  64. tree-sitter-typescript
  65. ] ++ lib.optionals withPlayground [
  66. tree-sitter-query
  67. ]))
  68. nvim-treesitter-textobjects
  69. extra-treesitter-textobjects
  70. nvim-lspconfig
  71. nvim-lsp-ts-utils
  72. null-ls-nvim
  73. fidget-nvim
  74. ] ++ lib.optionals withPlayground [
  75. playground
  76. ];
  77. };
  78. };
  79. }