aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/neovim/default.nix
blob: 415861ac263644d51c6b44f60fc4dece4402ec37 (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
47
48
49
50
51
52
53
54
55
56
57
{ config, lib, pkgs, ... }:

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

  config = lib.mkIf cfg.enable {
    xdg.configFile."nvim/lua".source = pkgs.lib.mkForce ./lua;

    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
        ]))
      ];

      extraLuaConfig = ''
        vim.g.mapleader = " "
        vim.g.maplocalleader = "\\"

        require('options')
        require('keymaps')
        require('plugins')
        require('autocmds')
      '';
    };

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