lazy: use similar API to nvf keymaps

This commit is contained in:
Pei Yang Ching 2024-08-24 12:30:20 +02:00
parent 05156b4e1b
commit 945b9e6500
2 changed files with 18 additions and 9 deletions

View file

@ -88,16 +88,21 @@
default = null;
};
lhs = mkOption {
key = mkOption {
type = str;
description = "Key to bind to";
};
rhs = mkOption {
type = nullOr (either str luaInline);
action = mkOption {
type = nullOr str;
default = null;
# FIXME: use a separate flag to indicate lua instead of luaInline
description = "Action to trigger. luaInline code will be wrapped in a function.";
description = "Action to trigger.";
};
lua = mkOption {
type = bool;
default = false;
description = "If true the action is treated as a lua function instead of a vim command.";
};
mode = mkOption {

View file

@ -18,12 +18,16 @@
expr,
nowait,
ft,
lhs,
rhs,
key,
action,
lua,
mode,
}: {
"@1" = lhs;
"@2" = rhs;
"@1" = key;
"@2" =
if lua
then mkLuaInline action
else action;
inherit desc noremap expr nowait ft mode;
};