From 745da4539edc8b4189fcab4de0e2afb9fe4bea45 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 5 Dec 2024 00:09:40 +0100 Subject: [PATCH] keymaps: fix null key problems --- modules/neovim/mappings/options.nix | 2 +- modules/wrapper/rc/config.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix index 8f0e8ebf..98e04a65 100644 --- a/modules/neovim/mappings/options.nix +++ b/modules/neovim/mappings/options.nix @@ -32,7 +32,7 @@ mapConfigOptions // { key = mkOption { - type = str; + type = nullOr str; description = "The key that triggers this keybind."; }; mode = mkOption { diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 627fd05b..ff8a4585 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -5,7 +5,7 @@ }: let inherit (builtins) map mapAttrs filter; inherit (lib.attrsets) mapAttrsToList; - inherit (lib.strings) concatLines concatMapStringsSep optionalString; + inherit (lib.strings) concatLines concatMapStringsSep; inherit (lib.trivial) showWarnings; inherit (lib.generators) mkLuaInline; 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)})"; - keymaps = concatLines (map toLuaKeymap cfg.keymaps); + keymaps = concatLines (map toLuaKeymap (filter (x: x.key != null) cfg.keymaps)); in { vim = { luaConfigRC = {