utility/qmk: rename to utility/qmk-nvim

This commit is contained in:
Poseidon 2025-08-17 17:32:51 -05:00
commit b9047100e5
No known key found for this signature in database
4 changed files with 3 additions and 3 deletions

View file

@ -0,0 +1,36 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAfter;
cfg = config.vim.utility.qmk-nvim;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["qmk-nvim"];
pluginRC.qmk-nvim = entryAfter ["nvim-notify"] ''
require('qmk').setup(${toLuaObject cfg.setupOpts})
'';
};
assertions = [
{
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";
}
{
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.";
}
];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./qmk.nix
];
}

View file

@ -0,0 +1,49 @@
{lib, ...}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf nullOr enum lines str;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.utility.qmk-nvim = {
enable = mkEnableOption "QMK and ZMK keymaps in nvim";
setupOpts = mkPluginSetupOption "qmk.nvim" {
name = mkOption {
type = nullOr str;
default = null;
description = "The name of the layout";
};
layout = mkOption {
type = nullOr lines;
default = null;
description = ''
The keyboard key layout
see <https://github.com/codethread/qmk.nvim?tab=readme-ov-file#Layout> for more details
'';
};
variant = mkOption {
type = enum ["qmk" "zmk"];
default = "qmk";
description = "Chooses the expected hardware target";
};
comment_preview = {
position = mkOption {
type = enum ["top" "bottom" "inside" "none"];
default = "top";
description = "Controls the position of the preview";
};
keymap_overrides = mkOption {
type = attrsOf str;
default = {};
description = ''
Key codes to text replacements
see <https://github.com/codethread/qmk.nvim/blob/main/lua/qmk/config/key_map.lua> for more details
'';
};
};
};
};
}