wrapper/lazy: allow luaInline as a type in keys

One way of using keys is `{ "<C-x>", mode = "n" }`, which isn't possible
in nvf without luaInline
This commit is contained in:
diniamo 2024-12-20 18:57:35 +01:00
commit d8e6483c64
3 changed files with 4 additions and 4 deletions

View file

@ -6,7 +6,7 @@
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair; inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair;
inherit (lib.strings) hasPrefix removePrefix; inherit (lib.strings) hasPrefix removePrefix;
inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr; inherit (lib.types) submodule either package enum str lines anything listOf nullOr;
# Get the names of all flake inputs that start with the given prefix. # Get the names of all flake inputs that start with the given prefix.
fromInputs = { fromInputs = {

View file

@ -97,7 +97,7 @@
keys = keys =
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set" if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys) then map toLuaLznKeySpec (filter (keySpec: keySpec.key != null) spec.keys)
# empty list or str or (listOf str) # empty list, str, (listOf str), luaInline or (listOf luaInline)
else spec.keys; else spec.keys;
}; };
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins; lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;

View file

@ -1,7 +1,7 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) enum listOf submodule nullOr str bool int attrsOf anything either oneOf lines; inherit (lib.types) enum listOf submodule nullOr str bool int attrsOf anything either oneOf lines;
inherit (lib.nvim.types) pluginType; inherit (lib.nvim.types) pluginType luaInline;
inherit (lib.nvim.config) mkBool; inherit (lib.nvim.config) mkBool;
lznKeysSpec = submodule { lznKeysSpec = submodule {
@ -135,7 +135,7 @@
}; };
keys = mkOption { keys = mkOption {
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]); type = nullOr (oneOf [(listOf lznKeysSpec) str (listOf str) luaInline (listOf luaInline)]);
default = null; default = null;
example = '' example = ''
keys = [ keys = [