summaryrefslogtreecommitdiffstats
path: root/docs/manual/configuring/keybinds.md
blob: a7c5a6266d28e5af43136861bc7698a5402094a6 (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
# Custom keymaps {#ch-keymaps}

Some plugin modules provide keymap options for your convenience. These can be
disabled by toggling {option}`vim.vendoredKeymaps.enable`. It is also possible
to disable individual keymaps with options by setting them to `null`. If a
keymap is not provided by a module, you may easily register your own custom
keymaps via {option}`vim.keymaps`.

```nix
{
  config.vim.keymaps = [
    {
      key = "<leader>m";
      mode = "n";
      silent = true;
      action = ":make<CR>";
    }
    {
      key = "<leader>l";
      mode = ["n" "x"];
      silent = true;
      action = "<cmd>cnext<CR>";
    }
    {
      key = "<leader>k";
      mode = ["n" "x"];

      # While `lua` is `true`, `action` is expected to be
      # a valid Lua expression.
      lua = true;
      action = ''
        function()
          require('foo').do_thing()
          print('did thing')
        end
      '';
    }
  ];
}
```