Define keyBind interface in submodule.

This commit is contained in:
Kevin Baensch 2024-11-28 16:21:04 +01:00
parent 751da80178
commit ac43fae727
Signed by: derped
GPG key ID: C0F1D326C7626543

View file

@ -2,7 +2,34 @@
let let
mkOption = lib.mkOption; mkOption = lib.mkOption;
types = lib.types; types = lib.types;
plugin = types.submodule ( keyBind = (
{ ... }:
{
options = {
bind = mkOption {
type = types.str;
default = "";
description = ''The keys to bind.'';
};
cmd = mkOption {
type = with types; nullOr str;
default = null;
description = ''The command to execute. If this is a lua function set cmdIsFunction to true.'';
};
cmdIsFunction = mkOption {
type = types.bool;
default = false;
description = ''Needs to be set to true if cmd is a lua function.'';
};
opts = mkOption {
type = with types; nullOr attrs;
default = null;
description = ''Additional named parameters passed to the keybind function.'';
};
};
}
);
plugin = (
{ ... }: { ... }:
{ {
options = { options = {
@ -150,7 +177,7 @@ let
}; };
keys = mkOption { keys = mkOption {
# TODO: update; # TODO: update;
type = with types; nullOr (listOf attrs); type = with types; nullOr (listOf (submodule keyBind));
default = null; default = null;
description = ''Lazy-load on key mapping.''; description = ''Lazy-load on key mapping.'';
}; };
@ -195,7 +222,7 @@ in
with types; with types;
listOf (oneOf [ listOf (oneOf [
str str
plugin (submodule plugin)
]); ]);
default = [ ]; default = [ ];
description = ''List of plugins to be installed with neovim.''; description = ''List of plugins to be installed with neovim.'';