DEVELOPMENT ENVIRONMENT

~liljamo/nvim-flake

nvim-flake/config/plugins/cmp.nix -rw-r--r-- 1.2 KiB
5fc3e3c8Jonni Liljamo feat(lsp): pylsp 7 days ago
                                                                                
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
{
  opts = {
    completeopt = [ "menu" "menuone" "noselect"];
  };
  extraConfigLua = ''
    vim.opt.shortmess:append "c"
  '';
  plugins = {
    cmp = {
      enable = true;
      settings = {
        sources = [
          { name = "nvim_lsp"; }
          { name = "async_path"; }
          { name = "buffer"; }
        ];
        mapping = {
          "<C-n>" = "cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }";
          "<C-p>" = "cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }";
          "<C-y>" = ''
            cmp.mapping(
              cmp.mapping.confirm {
                behavior = cmp.ConfirmBehavior.Insert,
                select = true,
              },
              { "i", "c" }
            )
          '';
          "<C-space>" = ''
            cmp.mapping(function()
              if cmp.visible() then
                cmp.close()
              else
                cmp.complete()
              end
            end)
          '';
        };
      };
    };
    cmp-async-path.enable = true;
    cmp-buffer.enable = true;
    cmp-nvim-lsp.enable = true;

    lspkind = {
      enable = true;
      cmp.enable = true;
    };
  };
}