modules/highlights: fix mkIf

This commit is contained in:
Pedro Alves 2023-01-21 17:09:32 +00:00
parent 82fa648e04
commit be4e083fd2

View file

@ -28,8 +28,8 @@ with lib;
}; };
}; };
config = mkIf (config.highlight != { }) { config = mkIf (config.highlight != { } || config.matches != { }) {
extraConfigLuaPost = '' extraConfigLuaPost = (optionalString (config.highlight != { }) ''
-- Highlight groups {{ -- Highlight groups {{
do do
local highlights = ${helpers.toLuaObject config.highlight} local highlights = ${helpers.toLuaObject config.highlight}
@ -39,16 +39,18 @@ with lib;
end end
end end
-- }} -- }}
'') ++
(optionalString (config.matches != { }) ''
-- Match groups {{ -- Match groups {{
do do
local match = ${helpers.toLuaObject config.match} local match = ${helpers.toLuaObject config.match}
for k,v in pairs(match) do for k,v in pairs(match) do
vim.fn.matchadd(k, v) vim.fn.matchadd(k, v)
end
end end
end -- }}
-- }} '');
'';
}; };
} }