mappings: deprecate vim.maps

This commit is contained in:
Ching Pei Yang 2026-06-12 14:01:12 +02:00 committed by Ching Pei Yang
commit caef79e398

View file

@ -1,13 +1,14 @@
{ {
options,
config, config,
lib, lib,
... ...
}: let }: let
inherit (lib.modules) mkMerge; inherit (lib.modules) mkMerge;
inherit (lib.options) mkOption literalMD; inherit (lib.options) mkOption literalMD showFiles;
inherit (lib.types) either str listOf attrsOf nullOr submodule; inherit (lib.types) either str listOf attrsOf nullOr submodule;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) flatten; inherit (lib.lists) flatten optional;
inherit (lib.trivial) pipe; inherit (lib.trivial) pipe;
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
inherit (lib.nvim.config) mkBool; inherit (lib.nvim.config) mkBool;
@ -63,10 +64,10 @@
legacyMapOption = mode: legacyMapOption = mode:
mkOption { mkOption {
description = "Mappings for ${mode} mode"; description = "Mappings for ${mode} mode";
visible = false;
type = attrsOf (submodule { type = attrsOf (submodule {
options = mapConfigOptions; options = mapConfigOptions;
}); });
default = {};
}; };
legacyMapModes = { legacyMapModes = {
@ -152,5 +153,14 @@ in {
] ]
) )
]; ];
# 2026-06-12
warnings = mkMerge (mapAttrsToList (
name: option:
optional
option.isDefined
"The option `vim.maps.${name}` defined in ${showFiles option.files} is deprecated, please use `vim.keymaps` instead. "
)
options.vim.maps);
}; };
} }