diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix index f05de21b..49e72494 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -1,6 +1,6 @@ {lib, ...}: let inherit (lib.options) mkOption; - inherit (lib.types) either str listOf attrsOf nullOr submodule; + inherit (lib.types) either str listOf attrsOf nullOr submodule bool; inherit (lib.nvim.config) mkBool; mapConfigOptions = { @@ -33,7 +33,9 @@ // { key = mkOption { type = str; - description = "The key that triggers this keybind."; + description = '' + Key that triggers this keybind. + ''; }; mode = mkOption { type = either str (listOf str); @@ -42,17 +44,20 @@ See `:help map-modes` for a list of modes. ''; - example = ''`["n" "v" "c"]` for normal, visual and command mode''; + example = ''"nvc" for normal, visual and command mode''; }; }; }; - legacyMapOption = mode: + # legacy stuff + legacyMapOption = submodule { + options = mapConfigOptions; + }; + + mapOptions = mode: mkOption { description = "Mappings for ${mode} mode"; - type = attrsOf (submodule { - options = mapConfigOptions; - }); + type = attrsOf legacyMapOption; default = {}; }; in { @@ -80,18 +85,18 @@ in { }; maps = { - normal = legacyMapOption "normal"; - insert = legacyMapOption "insert"; - select = legacyMapOption "select"; - visual = legacyMapOption "visual and select"; - terminal = legacyMapOption "terminal"; - normalVisualOp = legacyMapOption "normal, visual, select and operator-pending (same as plain 'map')"; + normal = mapOptions "normal"; + insert = mapOptions "insert"; + select = mapOptions "select"; + visual = mapOptions "visual and select"; + terminal = mapOptions "terminal"; + normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')"; - visualOnly = legacyMapOption "visual only"; - operator = legacyMapOption "operator-pending"; - insertCommand = legacyMapOption "insert and command-line"; - lang = legacyMapOption "insert, command-line and lang-arg"; - command = legacyMapOption "command-line"; + visualOnly = mapOptions "visual only"; + operator = mapOptions "operator-pending"; + insertCommand = mapOptions "insert and command-line"; + lang = mapOptions "insert, command-line and lang-arg"; + command = mapOptions "command-line"; }; }; } diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 6f9ed1ce..2a950a25 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -43,7 +43,9 @@ in { toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})"; - keymaps = concatLines (map toLuaKeymap cfg.keymaps); + maps = concatLines (map toLuaKeymap cfg.keymaps); + + keymaps = maps; in { vim = { luaConfigRC = {