mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
nixvim: support highlight groups
This commit is contained in:
parent
faf0a946b4
commit
bd5c46202e
3 changed files with 43 additions and 6 deletions
30
modules/highlights.nix
Normal file
30
modules/highlights.nix
Normal 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
|
||||||
|
-- }}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
12
tests/flake.lock
generated
12
tests/flake.lock
generated
|
@ -97,12 +97,12 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"narHash": "sha256-2xKbMFW3jSlyvl1ZKoe9sNe4h5k5Qk410Dom4TU3nls=",
|
"narHash": "sha256-3m9eDTuaK9RS8HpctJwSu1wnyx5/CILSGppr+6OjTPw=",
|
||||||
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
"path": "/nix/store/pp50jx20wrkbrkv3mxkwzckciy8xcqy2-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
"path": "/nix/store/pp50jx20wrkbrkv3mxkwzckciy8xcqy2-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -116,12 +116,12 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 0,
|
||||||
"narHash": "sha256-2xKbMFW3jSlyvl1ZKoe9sNe4h5k5Qk410Dom4TU3nls=",
|
"narHash": "sha256-3m9eDTuaK9RS8HpctJwSu1wnyx5/CILSGppr+6OjTPw=",
|
||||||
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
"path": "/nix/store/pp50jx20wrkbrkv3mxkwzckciy8xcqy2-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/89k711hq8f8j87h2kadz5kivkcpxjv58-source",
|
"path": "/nix/store/pp50jx20wrkbrkv3mxkwzckciy8xcqy2-source",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -211,6 +211,13 @@
|
||||||
lspkind.enable = true;
|
lspkind.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
highlight = build {
|
||||||
|
options.termguicolors = true;
|
||||||
|
highlight = {
|
||||||
|
Normal.fg = "#ff0000";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
})) // {
|
})) // {
|
||||||
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.nixvim-machine = nixpkgs.lib.nixosSystem {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue