From be4e083fd2b0093d7ace6179796410832761e2da Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sat, 21 Jan 2023 17:09:32 +0000 Subject: [PATCH] modules/highlights: fix mkIf --- modules/highlights.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/highlights.nix b/modules/highlights.nix index 1758d403..0c6c473a 100644 --- a/modules/highlights.nix +++ b/modules/highlights.nix @@ -28,8 +28,8 @@ with lib; }; }; - config = mkIf (config.highlight != { }) { - extraConfigLuaPost = '' + config = mkIf (config.highlight != { } || config.matches != { }) { + extraConfigLuaPost = (optionalString (config.highlight != { }) '' -- Highlight groups {{ do local highlights = ${helpers.toLuaObject config.highlight} @@ -39,16 +39,18 @@ with lib; end end -- }} - + '') ++ + (optionalString (config.matches != { }) '' -- Match groups {{ - do - local match = ${helpers.toLuaObject config.match} + do + local match = ${helpers.toLuaObject config.match} - for k,v in pairs(match) do - vim.fn.matchadd(k, v) + for k,v in pairs(match) do + vim.fn.matchadd(k, v) + end end - end - -- }} - ''; + -- }} + ''); }; } +