mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 15:35:30 +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
|
|
@ -35,7 +35,7 @@ in {
|
||||||
./svelte.nix
|
./svelte.nix
|
||||||
./tailwind.nix
|
./tailwind.nix
|
||||||
./terraform.nix
|
./terraform.nix
|
||||||
./tex.nix
|
./tex
|
||||||
./ts.nix
|
./ts.nix
|
||||||
./typst.nix
|
./typst.nix
|
||||||
./vala.nix
|
./vala.nix
|
||||||
|
|
|
||||||
|
|
@ -142,20 +142,25 @@
|
||||||
custom = buildConfig: buildConfig.custom.args;
|
custom = buildConfig: buildConfig.custom.args;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./treesitter.nix
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.languages.tex = {
|
options.vim.languages.tex = {
|
||||||
enable = mkEnableOption "Tex support";
|
enable = mkEnableOption "Tex support";
|
||||||
|
|
||||||
# Treesitter options for latex and bibtex flavours of tex.
|
# # Treesitter options for latex and bibtex flavours of tex.
|
||||||
treesitter = {
|
# treesitter = {
|
||||||
latex = {
|
# latex = {
|
||||||
enable = mkEnableTreesitterOption "Whether to enable Latex treesitter";
|
# enable = mkEnableTreesitterOption "Whether to enable Latex treesitter";
|
||||||
package = mkGrammarOption pkgs "latex";
|
# package = mkGrammarOption pkgs "latex";
|
||||||
};
|
# };
|
||||||
bibtex = {
|
# bibtex = {
|
||||||
enable = mkEnableTreesitterOption "Whether to enable Bibtex treesitter";
|
# enable = mkEnableTreesitterOption "Whether to enable Bibtex treesitter";
|
||||||
package = mkGrammarOption pkgs "bibtex";
|
# package = mkGrammarOption pkgs "bibtex";
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
|
|
||||||
# LSP options
|
# LSP options
|
||||||
# Because tex LSPs also including building/compiling tex, they have
|
# Because tex LSPs also including building/compiling tex, they have
|
||||||
|
|
@ -485,15 +490,15 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
# Treesitter
|
# # Treesitter
|
||||||
(mkIf cfg.treesitter.latex.enable {
|
# (mkIf cfg.treesitter.latex.enable {
|
||||||
vim.treesitter.enable = true;
|
# vim.treesitter.enable = true;
|
||||||
vim.treesitter.grammars = [cfg.treesitter.latex.package];
|
# vim.treesitter.grammars = [cfg.treesitter.latex.package];
|
||||||
})
|
# })
|
||||||
(mkIf cfg.treesitter.bibtex.enable {
|
# (mkIf cfg.treesitter.bibtex.enable {
|
||||||
vim.treesitter.enable = true;
|
# vim.treesitter.enable = true;
|
||||||
vim.treesitter.grammars = [cfg.treesitter.bibtex.package];
|
# vim.treesitter.grammars = [cfg.treesitter.bibtex.package];
|
||||||
})
|
# })
|
||||||
|
|
||||||
# LSP
|
# LSP
|
||||||
(mkIf (any (x: x.enable) (attrValues cfg.lsp)) (
|
(mkIf (any (x: x.enable) (attrValues cfg.lsp)) (
|
||||||
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