diff --git a/docs/manual/release-notes/rl-0.9.md b/docs/manual/release-notes/rl-0.9.md index 662f7aeb..09602f16 100644 --- a/docs/manual/release-notes/rl-0.9.md +++ b/docs/manual/release-notes/rl-0.9.md @@ -178,4 +178,8 @@ https://github.com/gorbit99/codewindow.nvim - Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and `setupOpts` +[irobot](https://github.com/irobot): + +- Add `remap` option to `vim.keymaps` + diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix index 98e04a65..2c622b43 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -1,6 +1,6 @@ {lib, ...}: let inherit (lib.options) mkOption literalMD; - 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 = { @@ -25,6 +25,12 @@ expr = mkBool false "Means that the action is actually an expression. Equivalent to adding to a map."; unique = mkBool false "Whether to fail if the map is already defined. Equivalent to adding to a map."; noremap = mkBool true "Whether to use the 'noremap' variant of the command, ignoring any custom mappings on the defined action. It is highly advised to keep this on, which is the default."; + remap = mkOption { + default = false; + type = bool; + internal = true; + description = "'noremap' is on by default. This option is used internally when noremap is set to false."; + }; }; mapType = submodule { diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 77a62d58..8781cedd 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -37,9 +37,11 @@ in { then mkLuaInline keymap.action else keymap.action; - getOpts = keymap: { - inherit (keymap) desc silent nowait script expr unique noremap; - }; + getOpts = keymap: + { + inherit (keymap) desc silent nowait script expr unique noremap; + } + // {remap = !keymap.noremap;}; toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";