nixvim: support highlight groups

This commit is contained in:
Pedro Alves 2022-11-11 02:15:23 +00:00
parent faf0a946b4
commit bd5c46202e
3 changed files with 43 additions and 6 deletions

30
modules/highlights.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, lib, helpers, ... }:
with lib;
{
options = {
highlight = mkOption {
type = types.attrsOf types.anything;
default = { };
description = "Define highlight groups";
example = ''
highlight = {
Comment.fg = '#ff0000';
};
'';
};
};
config = mkIf (config.highlight != { }) {
extraConfigLuaPost = ''
-- Highlight groups {{
do
local highlights = ${helpers.toLuaObject config.highlight}
for k,v in pairs(highlights) do
vim.api.nvim_set_hl(0, k, v)
end
end
-- }}
'';
};
}