keymaps: fix null key problems

This commit is contained in:
Ching Pei Yang 2024-12-05 00:09:40 +01:00
parent 66d0a81206
commit 745da4539e
No known key found for this signature in database
GPG key ID: B3841364253DC4C8
2 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@
mapConfigOptions mapConfigOptions
// { // {
key = mkOption { key = mkOption {
type = str; type = nullOr str;
description = "The key that triggers this keybind."; description = "The key that triggers this keybind.";
}; };
mode = mkOption { mode = mkOption {

View file

@ -5,7 +5,7 @@
}: let }: let
inherit (builtins) map mapAttrs filter; inherit (builtins) map mapAttrs filter;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.strings) concatLines concatMapStringsSep optionalString; inherit (lib.strings) concatLines concatMapStringsSep;
inherit (lib.trivial) showWarnings; inherit (lib.trivial) showWarnings;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere; inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere;
@ -43,7 +43,7 @@ in {
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})"; toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
keymaps = concatLines (map toLuaKeymap cfg.keymaps); keymaps = concatLines (map toLuaKeymap (filter (x: x.key != null) cfg.keymaps));
in { in {
vim = { vim = {
luaConfigRC = { luaConfigRC = {