2025-01-23 16:08:31 -07:00
|
|
|
{
|
|
|
|
|
config,
|
|
|
|
|
pkgs,
|
|
|
|
|
lib,
|
|
|
|
|
...
|
2025-01-23 17:05:25 -07:00
|
|
|
}: let
|
2025-02-10 17:35:57 -07:00
|
|
|
# inherit (lib.options) mkEnableOption;
|
2025-01-23 16:08:31 -07:00
|
|
|
inherit (lib.modules) mkIf mkMerge;
|
2025-02-10 17:35:57 -07:00
|
|
|
inherit (lib.nvim.types) mkGrammarOption mkEnableTreesitterOption;
|
2025-01-23 16:08:31 -07:00
|
|
|
|
|
|
|
|
cfg = config.vim.languages.tex;
|
|
|
|
|
|
2025-02-10 17:35:57 -07:00
|
|
|
# mkEnableTreesitterOption = description: mkEnableOption description // {default = config.vim.languages.enableTreesitter;};
|
2025-01-23 17:05:25 -07:00
|
|
|
in {
|
2025-01-23 16:08:31 -07:00
|
|
|
options.vim.languages.tex.treesitter = {
|
|
|
|
|
latex = {
|
2025-02-10 17:35:57 -07:00
|
|
|
# enable = mkEnableTreesitterOption "Whether to enable Latex treesitter";
|
|
|
|
|
enable = mkEnableTreesitterOption config "latex";
|
2025-01-23 16:08:31 -07:00
|
|
|
package = mkGrammarOption pkgs "latex";
|
|
|
|
|
};
|
|
|
|
|
bibtex = {
|
2025-02-10 17:35:57 -07:00
|
|
|
# enable = mkEnableTreesitterOption "Whether to enable Bibtex treesitter";
|
|
|
|
|
enable = mkEnableTreesitterOption config "bibtex";
|
2025-01-23 16:08:31 -07:00
|
|
|
package = mkGrammarOption pkgs "bibtex";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable (mkMerge [
|
|
|
|
|
(mkIf cfg.treesitter.latex.enable {
|
|
|
|
|
vim.treesitter.enable = true;
|
2025-01-23 17:05:25 -07:00
|
|
|
vim.treesitter.grammars = [cfg.treesitter.latex.package];
|
2025-01-23 16:08:31 -07:00
|
|
|
})
|
|
|
|
|
(mkIf cfg.treesitter.bibtex.enable {
|
|
|
|
|
vim.treesitter.enable = true;
|
2025-01-23 17:05:25 -07:00
|
|
|
vim.treesitter.grammars = [cfg.treesitter.bibtex.package];
|
2025-01-23 16:08:31 -07:00
|
|
|
})
|
|
|
|
|
]);
|
|
|
|
|
}
|