Custom key bindings with nixvim

Let me answer my own question so that someone might be saved from tears.

This issue is caused by my lack of experience with nvim. In fact all the mappings that require combination of keys needs to be surrounded with < >. Otherwise they represent a sequence of keys.

So the correct code is:

  programs.nixvim = {
    enable = true;
    # ...
    keymaps = [
      {
        action = "<cmd>Neotree toggle<CR>";
        key = "<C-b>";  # this line is changed
        mode = "n";
        options = {
          desc = "Toggle Tree View.";
        };
      }
    ];
   # ...
};
4 Likes