summaryrefslogtreecommitdiff
path: root/home/neovim/config.nix
blob: b775e77bd2dad076f98a2ea07ccad4a7d5134910 (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
{
  lib,
  config,
}: let
  inherit (lib) optionalAttrs;
in
  (lib.generators.toLua {}) {
    # Width of tabs in the editor
    tabwidth = 4;
    # If tabs should be expanded to spaces
    expandtab = false;
    keys = {
      # NeoVIM leader key
      leader = " ";
      # Keybind to remove active hilighted content
      noh = "<leader>h";
      menus = {
        # Open file browser
        browser = "<leader>e";
        # Show active buffers
        buffers = "<leader>fb";
        # Show LSP errors
        error = "<leader>t";
        # Find files in working directory
        find = "<leader>ff";
        # Grep files in working directory
        grep = "<leader>fg";
        # Search help menu
        help = "<leader>fh";
        # Voew undo tree
        undo = "<leader>u";
      };
      lsp = {
        # Open LSP hover menu on a value
        hover = "K";
        # Perform an LSP action on a value
        action = "<leader>la";
        # View all references of a value
        references = "<leader>lr";
        # Rename current and all references of a value
        rename = "<leader>ln";
      };
      cmp = {
        # Select previous value in completion engine
        prev = "<C-p>";
        # Select next value in completion engine
        next = "<C-n>";
        # Confirm current value in completion engine
        confirm = "<CR>";
        # Auto complete using completion engine
        complete = "<C-space>";
      };
    };
    # list of lsp servers to load
    lsps =
      optionalAttrs config.development.c {
        clangd = {};
      }
      // optionalAttrs config.development.java {
        jdtls = {};
        kotlin_language_server = {};
      }
      // optionalAttrs config.development.lua {
        lua_ls = {
          Lua = {
            diagnostics = {
              globals = ["vim"];
            };
          };
        };
      }
      // optionalAttrs config.development.rust {
        rust_analyzer = {};
      }
      // optionalAttrs config.development.web {
        ts_ls = {};
        phpactor = {};
      }
      // optionalAttrs config.development.zig {
        zls = {};
      };
    highlight = {
      # max file size in KiB to attempt to parse
      max_size = 1024;
    };
    # colorscheme
    theme = {
      colors = {
        base00 = "#${config.theme.colors.base}";
        base01 = "#${config.theme.colors.surface}";
        base02 = "#${config.theme.colors.surface}";
        base03 = "#${config.theme.colors.subtext}";
        base04 = "#${config.theme.colors.subtext}";
        base05 = "#${config.theme.colors.text}";
        base06 = "#${config.theme.colors.text}";
        base07 = "#${config.theme.colors.overlay}";
        base08 = "#${config.theme.colors.bright.red}";
        base09 = "#${config.theme.colors.bright.orange}";
        base0A = "#${config.theme.colors.bright.yellow}";
        base0B = "#${config.theme.colors.bright.green}";
        base0C = "#${config.theme.colors.bright.cyan}";
        base0D = "#${config.theme.colors.bright.blue}";
        base0E = "#${config.theme.colors.bright.magenta}";
        base0F = "#${config.theme.colors.bright.pink}";
      };
      transparent = true;
    };
    # max column width
    col = {
      # show a bar at `width` characters
      show = true;
      width = 80;
    };
  }