mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
utility/qmk: add defaults and asserts
Add default values and assertions for required options.
This commit is contained in:
parent
ea55488f04
commit
059c508842
2 changed files with 22 additions and 13 deletions
|
@ -18,9 +18,19 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
assertions = [{
|
assertions = [
|
||||||
assertion = !(cfg.setupOpts.variant == "zmk") && !(cfg.setupOpts.comment_preview.position == "inside");
|
{
|
||||||
|
assertion = cfg.setupOpts.variant != "zmk" && cfg.setupOpts.comment_preview.position != "inside";
|
||||||
message = "comment_preview.position can only be set to inside when using the qmk layoyt";
|
message = "comment_preview.position can only be set to inside when using the qmk layoyt";
|
||||||
}];
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.setupOpts.name != null;
|
||||||
|
message = "qmk-nvim requires 'vim.utility.qmk.setupOpts.name' to be set.";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.setupOpts.layout != null;
|
||||||
|
message = "qmk-nvim requires 'vim.utility.qmk.setupOpts.layout' to be set.";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
{
|
{lib, ...}: let
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf enum lines str;
|
inherit (lib.types) attrsOf nullOr enum lines str;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
options.vim.utility.qmk = {
|
options.vim.utility.qmk = {
|
||||||
|
@ -11,12 +8,14 @@ in {
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "qmk.nvim" {
|
setupOpts = mkPluginSetupOption "qmk.nvim" {
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = str;
|
type = nullOr str;
|
||||||
|
default = null;
|
||||||
description = "The name of the layout";
|
description = "The name of the layout";
|
||||||
};
|
};
|
||||||
|
|
||||||
layout = mkOption {
|
layout = mkOption {
|
||||||
type = lines;
|
type = nullOr lines;
|
||||||
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
The keyboard key layout
|
The keyboard key layout
|
||||||
see <https://github.com/codethread/qmk.nvim?tab=readme-ov-file#Layout> for more details
|
see <https://github.com/codethread/qmk.nvim?tab=readme-ov-file#Layout> for more details
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue