aboutsummaryrefslogtreecommitdiffstats
path: root/home/nvim/default.nix
blob: 0c1a32a673c09a14570339948198638dba85f567 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{ unstable, ... }:

{
  programs.neovim =
    let
      toLua = str: "lua << EOF\n${str}\nEOF\n";
      toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
      grammarsPath = unstable.symlinkJoin {
        name = "treesitter-grammars";
        paths = unstable.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
      };
    in
    {
      enable = true;
      defaultEditor = true;
      viAlias = true;
      vimAlias = true;
      vimdiffAlias = true;
      extraPackages = with unstable; [
        inotify-tools

        # debuggers
        delve # golang debugger
        lldb # rust, c, etc, debugger

        # format
        rustfmt
        dprint # platform for many formatters
        yamlfmt

        # LSP
        biome # javascript, biome
        clippy # rust error checking
        clang-tools # C
        dprint # format engine for multiple langeuages
        dprint-plugins.dprint-plugin-markdown # markdown
        dprint-plugins.dprint-plugin-toml # toml
        dprint-plugins.g-plane-malva # css
        dprint-plugins.g-plane-markup_fmt # html
        dprint-plugins.g-plane-pretty_yaml # yaml
        fish-lsp # fish
        gopls # golang
        ltex-ls # latex, markdown
        lua-language-server # lua
        nil # lsp server for nix
        nodePackages.bash-language-server # bash
        nodePackages.typescript-language-server # javascript validation
        ruff # python format and lint
        rust-analyzer
        tex-fmt # latex
        texlab # latex lsp
        tree-sitter # generate tree-sitter grammars
        ty # python type checker written in rust
        vale-ls # prose (md, asciidoc)
      ];

      extraPython3Packages = ps: [
        ps.debugpy
        ps.pynvim
      ];
      plugins = with unstable.vimPlugins; [
        {
          plugin = nvim-dap;
          config = toLuaFile ./plugins/dap.lua;
        }
        {
          plugin = which-key-nvim;
          config = toLuaFile ./plugins/which.lua;
        }
        {
          plugin = undotree;
          config = toLuaFile ./plugins/undotree.lua;
        }
        {
          plugin = mini-nvim;
          config = toLuaFile ./plugins/mini.lua;
        }
        {
          plugin = nvim-treesitter.withAllGrammars;
          config = toLuaFile ./plugins/treesitter.lua;
        }
        hardtime-nvim
        nord-nvim
        nvim-dap-view
        nvim-dap-virtual-text
        tokyonight-nvim
      ];

      extraLuaConfig = ''
        -- Manually append Tree-sitter plugin and grammars to runtimepath
        vim.opt.runtimepath:append("${unstable.vimPlugins.nvim-treesitter}")
        vim.opt.runtimepath:append("${grammarsPath}")

        ${builtins.readFile ./lsp.lua}
        ${builtins.readFile ./autocommands.lua}
        ${builtins.readFile ./keymaps.lua}
        ${builtins.readFile ./options.lua}
        ${builtins.readFile ./plugins/other.lua}
      '';
    };

}