mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 14:45:58 +01:00
lib: add lz.n KeySpec
This commit is contained in:
parent
8369ca5602
commit
593435318d
1 changed files with 60 additions and 2 deletions
|
@ -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 oneOf;
|
inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr oneOf bool;
|
||||||
# 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 = {
|
||||||
inputs,
|
inputs,
|
||||||
|
@ -56,6 +56,64 @@
|
||||||
check = x: lib.nvim.lua.isLuaInline x;
|
check = x: lib.nvim.lua.isLuaInline x;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lznKeysSpec = submodule {
|
||||||
|
apply = x:
|
||||||
|
x
|
||||||
|
// {
|
||||||
|
"@1" = x.lhs;
|
||||||
|
"@2" = x.rhs;
|
||||||
|
};
|
||||||
|
|
||||||
|
options = {
|
||||||
|
desc = mkOption {
|
||||||
|
description = "Description of the key map";
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
noremap = mkOption {
|
||||||
|
description = "TBD";
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
expr = mkOption {
|
||||||
|
description = "TBD";
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
nowait = mkOption {
|
||||||
|
description = "TBD";
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
ft = mkOption {
|
||||||
|
description = "TBD";
|
||||||
|
type = nullOr (listOf str);
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
lhs = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "Key to bind to";
|
||||||
|
};
|
||||||
|
|
||||||
|
rhs = mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Action to trigger";
|
||||||
|
};
|
||||||
|
|
||||||
|
mode = mkOption {
|
||||||
|
description = "Modes to bind in";
|
||||||
|
type = listOf str;
|
||||||
|
default = ["n"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
lznPluginTableType = attrsOf lznPluginType;
|
lznPluginTableType = attrsOf lznPluginType;
|
||||||
lznPluginType = submodule {
|
lznPluginType = submodule {
|
||||||
options = {
|
options = {
|
||||||
|
@ -135,7 +193,7 @@
|
||||||
keys = mkOption {
|
keys = mkOption {
|
||||||
description = "Lazy-load on key mapping";
|
description = "Lazy-load on key mapping";
|
||||||
default = null;
|
default = null;
|
||||||
type = nullOr (either str (listOf str)); # TODO: support lz.n.KeysSpec
|
type = nullOr (oneOf [str (listOf str) lznKeysSpec]); # TODO: support lz.n.KeysSpec
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: enabled, beforeAll, colorscheme, priority, load
|
# TODO: enabled, beforeAll, colorscheme, priority, load
|
||||||
|
|
Loading…
Reference in a new issue