aboutsummaryrefslogtreecommitdiff
path: root/modules/neovim/default.nix
blob: f3200b31311c79170219fa6a55b6d1a257d34b81 (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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{ config, lib, pkgs, ...}:
let
  cfg = config.modules.neovim;
  scheme = config.modules.scheme;
  fromGitHub = ref: repo: pkgs.vimUtils.buildVimPlugin {
    pname = "${lib.strings.sanitizeDerivationName repo}"; version = ref; src = builtins.fetchGit {
      url = "https://github.com/${repo}.git";
      ref = ref;
    };
    doCheck = false;
  };
  tsparsers = pkgs.symlinkJoin {
    name = "tsparsers";
    paths = (pkgs.vimPlugins.nvim-treesitter.withAllGrammars).dependencies;
  };
in
{
  options.modules.neovim = {
    enable = lib.mkEnableOption "neovim";
  };

  config = lib.mkIf cfg.enable {
    xdg.configFile."nvim/lua" = {
      source = ./nvim/lua;
      recursive = true;
    };

    xdg.configFile."nvim/after" = {
      source = ./nvim/after;
      recursive = true;
    };

    xdg.configFile."nvim/colors" = {
      source = ./nvim/colors;
      recursive = true;
    };

    # home.sessionVariables.MANPAGER = "nvim +Man!";

    programs.neovim = {
      enable = true;
      defaultEditor = true;
      viAlias = false;
      vimAlias = false;
      vimdiffAlias = true;
      plugins = with pkgs.vimPlugins; [
        nvim-treesitter
        base16-nvim
        # nvim-treesitter.withAllGrammars
        {
          plugin = nvim-highlight-colors;
          type = "lua";
          config =
          # lua
          ''
            require("nvim-highlight-colors").setup {
              render = 'virtual',
              virtual_symbol_position = 'eow',
              virtual_symbol_prefix = " ",
              virtual_symbol_suffix = "",
            }
          '';
        }
        # (nvim-treesitter.withPlugins (p: with p; [
        #   tree-sitter-nix
        #   tree-sitter-make
        #   tree-sitter-cmake
        #   tree-sitter-verilog
        #   tree-sitter-scheme
        #   tree-sitter-llvm
        #   tree-sitter-html
        #   tree-sitter-glsl
        #   tree-sitter-devicetree
        #   tree-sitter-cuda
        #   tree-sitter-c
        #   tree-sitter-cpp
        #   tree-sitter-lua
        #   tree-sitter-zig
        #   tree-sitter-rust
        #   tree-sitter-haskell
        #   tree-sitter-toml
        #   tree-sitter-markdown
        #   tree-sitter-markdown-inline
        #   tree-sitter-tablegen
        # ]))

        {
          plugin = lean-nvim;
          config = 
          # lua
          ''
            require('lean').setup{ mappings = true }
          '';
          type = "lua";
        }
        plenary-nvim
        mini-icons
        oil-nvim
        tmux-nvim
        # noice-nvim
        nvim-lspconfig
        # blink-cmp
        telescope-nvim
        telescope-fzf-native-nvim
        # fzf-lua
#        https://github.com/ibhagwan/fzf-lua/commit/26095d98c2969730457bf5b483919280e2cfb8bb
        # (fromGitHub "HEAD" "ibhagwan/fzf-lua")
        # fzf-lua.overrideAttrs (finalAttrs: previousAttrs: {
        #    previousAttrs.doCheck = false;
        # })
        vim-obsession
        (pkgs.neovimUtils.buildNeovimPlugin {
          luaAttr = pkgs.luaPackages.fzf-lua;
          doCheck = false;
        })
      ];
      # extraLuaPackages = ps: with ps; [
      # ];
      extraLuaConfig = 
      ''
        ${builtins.readFile ./nvim/init.lua}
        vim.cmd[[${scheme.extraVimConfig}]]
        vim.cmd[[colorscheme ${scheme.name}]]
        vim.opt.runtimepath:prepend('${tsparsers}')
      '';
    };
  };
}