mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-18 08:18:38 +02:00
modules/highlights: fix mkIf
This commit is contained in:
parent
82fa648e04
commit
be4e083fd2
1 changed files with 12 additions and 10 deletions
|
@ -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
|
-- }}
|
||||||
-- }}
|
'');
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue