2023-04-17 22:05:18 +00:00
|
|
|
{
|
|
|
|
config,
|
2024-03-09 05:49:22 +00:00
|
|
|
pkgs,
|
2023-04-17 22:05:18 +00:00
|
|
|
lib,
|
|
|
|
...
|
2023-11-08 02:16:46 +00:00
|
|
|
}: let
|
2024-03-09 05:49:22 +00:00
|
|
|
inherit (lib.options) mkEnableOption mkOption;
|
|
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
|
|
inherit (lib.types) bool;
|
|
|
|
inherit (lib.lists) optional;
|
|
|
|
inherit (lib.nvim.types) mkGrammarOption;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2023-11-08 02:16:46 +00:00
|
|
|
|
2023-04-17 22:05:18 +00:00
|
|
|
cfg = config.vim.languages.html;
|
|
|
|
in {
|
|
|
|
options.vim.languages.html = {
|
|
|
|
enable = mkEnableOption "HTML language support";
|
|
|
|
treesitter = {
|
2024-03-09 05:49:22 +00:00
|
|
|
enable = mkEnableOption "HTML treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
|
|
|
package = mkGrammarOption pkgs "html";
|
2023-04-17 22:05:18 +00:00
|
|
|
autotagHtml = mkOption {
|
|
|
|
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
|
2024-03-09 05:49:22 +00:00
|
|
|
type = bool;
|
2023-04-17 22:05:18 +00:00
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable (mkMerge [
|
|
|
|
(mkIf cfg.treesitter.enable {
|
2024-03-09 05:49:22 +00:00
|
|
|
vim = {
|
|
|
|
startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag";
|
2023-04-17 22:05:18 +00:00
|
|
|
|
2024-03-09 05:49:22 +00:00
|
|
|
treesitter = {
|
|
|
|
enable = true;
|
|
|
|
grammars = [cfg.treesitter.package];
|
|
|
|
};
|
2023-04-17 22:05:18 +00:00
|
|
|
|
2024-03-09 05:49:22 +00:00
|
|
|
luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (entryAnywhere ''
|
|
|
|
require('nvim-ts-autotag').setup()
|
|
|
|
'');
|
|
|
|
};
|
2023-04-17 22:05:18 +00:00
|
|
|
})
|
|
|
|
]);
|
|
|
|
}
|