aboutsummaryrefslogtreecommitdiff
path: root/modules/neovim/default.nix
blob: e352b577c4464173d129cbb31a81e59058a9d20b (plain)
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
{ config, lib, pkgs, ... }:

let
  cfg = config.neovim;
in {
  options.neovim.enable = lib.mkEnableOption "Enable and setup neovim";

  config = lib.mkIf cfg.enable {
    programs.neovim = {
      enable = true;
      vimAlias = true;

      extraPackages = with pkgs; [
        lua-language-server
      ];

      plugins = with pkgs.vimPlugins; [
        lazy-nvim
        nvim-lspconfig
        friendly-snippets
        telescope-nvim

        (nvim-treesitter.withPlugins (plugins: with plugins; [
          tree-sitter-bash
          tree-sitter-c
          tree-sitter-json
          tree-sitter-lua
          tree-sitter-python
          tree-sitter-nix
          tree-sitter-vim
          tree-sitter-vimdoc
          tree-sitter-yaml
          tree-sitter-markdown
          tree-sitter-markdown_inline
        ]))
      ];
    };

    xdg.configFile."nvim/lua".source = ./lua;

    home.sessionVariables = rec {
      EDITOR = "nvim";
      GIT_EDITOR = EDITOR;
    };
  };
}