From 82fa648e048c993dd034b24d34544550b3c547b4 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 12 Jan 2023 16:44:02 +0100 Subject: [PATCH] modules/highlights: added a wrapper around vim.fn.matchadd --- modules/highlights.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/highlights.nix b/modules/highlights.nix index 0f5fc1f0..1758d403 100644 --- a/modules/highlights.nix +++ b/modules/highlights.nix @@ -15,6 +15,17 @@ with lib; }; ''; }; + + match = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Define match groups"; + example = '' + match = { + ExtraWhitespace = '\\s\\+$'; + }; + ''; + }; }; config = mkIf (config.highlight != { }) { @@ -28,6 +39,16 @@ with lib; end end -- }} + + -- Match groups {{ + do + local match = ${helpers.toLuaObject config.match} + + for k,v in pairs(match) do + vim.fn.matchadd(k, v) + end + end + -- }} ''; }; }