mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
modules/keymaps: deprecate lua
option
This commit is contained in:
parent
beb86eec7c
commit
8212bf1cd2
2 changed files with 37 additions and 4 deletions
|
@ -106,8 +106,12 @@ rec {
|
||||||
description = ''
|
description = ''
|
||||||
If true, `action` is considered to be lua code.
|
If true, `action` is considered to be lua code.
|
||||||
Thus, it will not be wrapped in `""`.
|
Thus, it will not be wrapped in `""`.
|
||||||
|
|
||||||
|
This option is deprecated and will be removed in 24.11.
|
||||||
|
You should use a "raw" action instead, e.g. `action.__raw = ""`.
|
||||||
'';
|
'';
|
||||||
default = defaults.lua or false;
|
default = defaults.lua or false;
|
||||||
|
visible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
options = mapConfigOptions;
|
options = mapConfigOptions;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
config,
|
config,
|
||||||
|
options,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -26,13 +27,11 @@ with lib;
|
||||||
"InsertEnter" = [
|
"InsertEnter" = [
|
||||||
{
|
{
|
||||||
key = "<C-y>";
|
key = "<C-y>";
|
||||||
action = ''require("cmp").mapping.confirm()'';
|
action.__raw = ''require("cmp").mapping.confirm()'';
|
||||||
lua = true;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key = "<C-n>";
|
key = "<C-n>";
|
||||||
action = ''require("cmp").mapping.select_next_item()'';
|
action.__raw = ''require("cmp").mapping.select_next_item()'';
|
||||||
lua = true;
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -52,6 +51,36 @@ with lib;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
# Deprecate `lua` keymap option
|
||||||
|
# TODO upgrade to an assertion (removal notice) in 24.11
|
||||||
|
# TODO remove entirely in 25.05?
|
||||||
|
warnings =
|
||||||
|
let
|
||||||
|
luaDefs = pipe options.keymaps.definitionsWithLocations [
|
||||||
|
(map (def: {
|
||||||
|
inherit (def) file;
|
||||||
|
value = filter (hasAttr "lua") def.value;
|
||||||
|
}))
|
||||||
|
(filter (def: def.value != [ ]))
|
||||||
|
(map (
|
||||||
|
def:
|
||||||
|
let
|
||||||
|
count = length def.value;
|
||||||
|
plural = count > 1;
|
||||||
|
in
|
||||||
|
"Found ${toString count} use${optionalString plural "s"} in ${def.file}"
|
||||||
|
))
|
||||||
|
];
|
||||||
|
in
|
||||||
|
optional (luaDefs != [ ]) ''
|
||||||
|
Nixvim (keymaps): the `lua` keymap option is deprecated.
|
||||||
|
|
||||||
|
This option will be removed in 24.11. You should use a "raw" `action` instead;
|
||||||
|
e.g. `action.__raw = "<lua code>"` or `action = helpers.mkRaw "<lua code>"`.
|
||||||
|
|
||||||
|
${concatStringsSep "\n" luaDefs}
|
||||||
|
'';
|
||||||
|
|
||||||
extraConfigLua = optionalString (config.keymaps != [ ]) ''
|
extraConfigLua = optionalString (config.keymaps != [ ]) ''
|
||||||
-- Set up keybinds {{{
|
-- Set up keybinds {{{
|
||||||
do
|
do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue