mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-11 07:55:31 +00:00
Starting modularizing tex.nix into smaller sections
This commit is contained in:
parent
9357bde934
commit
1f08c4eda7
3 changed files with 65 additions and 21 deletions
39
modules/plugins/languages/tex/treesitter.nix
Normal file
39
modules/plugins/languages/tex/treesitter.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
|
||||
mkEnableTreesitterOption =
|
||||
description: mkEnableOption description // { default = config.vim.languages.enableTreesitter; };
|
||||
in
|
||||
{
|
||||
options.vim.languages.tex.treesitter = {
|
||||
latex = {
|
||||
enable = mkEnableTreesitterOption "Whether to enable Latex treesitter";
|
||||
package = mkGrammarOption pkgs "latex";
|
||||
};
|
||||
bibtex = {
|
||||
enable = mkEnableTreesitterOption "Whether to enable Bibtex treesitter";
|
||||
package = mkGrammarOption pkgs "bibtex";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.latex.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [ cfg.treesitter.latex.package ];
|
||||
})
|
||||
(mkIf cfg.treesitter.bibtex.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [ cfg.treesitter.bibtex.package ];
|
||||
})
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue