plugins/todo-comments: support conditional key mapping

This commit is contained in:
Austin Horstman 2024-09-06 23:31:49 -05:00
parent 4e5bd1d79b
commit 87e3c4a1b2
No known key found for this signature in database
2 changed files with 26 additions and 1 deletions

View file

@ -373,8 +373,11 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
defaults = {
inherit action;
mode = "n";
key = null;
};
key.type = with types; nullOr str;
extraOptions = {
cwd = mkOption {
type = types.nullOr types.str;
@ -430,7 +433,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
extraPackages = [ cfg.ripgrepPackage ];
keymaps = lib.pipe cfg.keymaps [
(filterAttrs (n: keymap: keymap != null))
(filterAttrs (n: keymap: keymap != null && keymap.key != null))
(mapAttrsToList (
name: keymap: {
inherit (keymap) key mode options;