mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 01:08:43 +02:00
modules/keymap: improve lua
deprecation
- Replace nullable lua option with a no-default option. - Made it so the deprecated option is only declared when `lua = true` is passed. - Replace `normalizeMappings` with a `removeDeprecatedMapAttrs` helper. - Added warnings for all options that historically had `lua` support.
This commit is contained in:
parent
c52ba67856
commit
7fb1f9dd9d
6 changed files with 115 additions and 104 deletions
|
@ -35,9 +35,18 @@ in
|
|||
|
||||
keymaps = mapAttrs (
|
||||
action: defaults:
|
||||
helpers.mkNullOrOption (
|
||||
with types; either str (helpers.keymaps.mkMapOptionSubmodule { inherit defaults; })
|
||||
) "Keymap for the ${action} action."
|
||||
helpers.mkNullOrOption' {
|
||||
type =
|
||||
with types;
|
||||
coercedTo str (key: defaultKeymaps.${action} // { inherit key; }) (
|
||||
helpers.keymaps.mkMapOptionSubmodule {
|
||||
inherit defaults;
|
||||
lua = true;
|
||||
}
|
||||
);
|
||||
apply = v: if v == null then null else helpers.keymaps.removeDeprecatedMapAttrs v;
|
||||
description = "Keymap for the ${action} action.";
|
||||
}
|
||||
) defaultKeymaps;
|
||||
|
||||
popupType =
|
||||
|
@ -106,11 +115,7 @@ in
|
|||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
keymaps = filter (keymap: keymap != null) (
|
||||
mapAttrsToList (
|
||||
action: value: if isString value then defaultKeymaps.${action} // { key = value; } else value
|
||||
) cfg.keymaps
|
||||
);
|
||||
keymaps = filter (keymap: keymap != null) (attrValues cfg.keymaps);
|
||||
|
||||
extraConfigLua = ''
|
||||
require("wtf").setup(${helpers.toLuaObject setupOptions})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue