Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
ac75542
Created tex language options
isaacST08 Jan 19, 2025
7dceb8b
Fix import on the wrong line
isaacST08 Jan 19, 2025
d42896b
Added toString functions on Texlab LSP source booleans and other mapp…
isaacST08 Jan 19, 2025
286f292
Fixed typo
isaacST08 Jan 19, 2025
4fbc78c
Created function to simplify converting a string into lua format and …
isaacST08 Jan 19, 2025
186b6fd
Fixed weird nix boolean toString implementation
isaacST08 Jan 19, 2025
8a2a635
Changed texlab lsp config build.filename to use stringToLua function
isaacST08 Jan 19, 2025
52d36c0
Added tex to the languages list
isaacST08 Jan 19, 2025
25e2cfa
Fixed texlab needing to be installed globally to be able to use the lsp
isaacST08 Jan 19, 2025
60fe055
Added support for setting the g:tex_flavor option
isaacST08 Jan 19, 2025
187bf3e
Switched to Alejandra formatting style
isaacST08 Jan 19, 2025
d5920d1
Tex templates were broken in the current version of the new-file-temp…
isaacST08 Jan 22, 2025
54a64a4
Added texlab tectonic options
isaacST08 Jan 23, 2025
e78b4ff
Starting modularizing tex.nix into smaller sections
isaacST08 Jan 23, 2025
8f042ce
Moved lsp config into its own module
isaacST08 Jan 23, 2025
aa191b6
Migrated texlab into its own module
isaacST08 Jan 23, 2025
7ebbe28
Cleanup residue from modularization
isaacST08 Jan 24, 2025
31f212b
Created build module
isaacST08 Jan 24, 2025
2c856dc
Cleanup after makeing build module
isaacST08 Jan 24, 2025
77bb18f
Fixed typo
isaacST08 Jan 24, 2025
2e55442
Created builder template for making new builders that will work with …
isaacST08 Jan 24, 2025
aa75d98
Created latexmk builder
isaacST08 Jan 24, 2025
e0f0017
Pinned commit hash of new-file-template.nvim
isaacST08 Jan 25, 2025
a2ffaf8
Switched to using lib.nvim.config.mkBool where appropriate
isaacST08 Jan 26, 2025
8d7cac7
Refactored to use the nvf library toLuaObject as well as other improv…
isaacST08 Jan 27, 2025
847c1b5
Added diagnostic options for texlab
isaacST08 Jan 27, 2025
39fd4fe
Added general texlab options and some cleanup
isaacST08 Jan 27, 2025
179418e
Added latexindent options to texlab
isaacST08 Jan 27, 2025
a5fb966
Added completion options for texlab
isaacST08 Jan 27, 2025
80938d1
Added inlayHints options for texlab and some cleanup
isaacST08 Jan 27, 2025
9300f92
Added experimental options for texlab
isaacST08 Jan 27, 2025
d7de68f
Removed old files
isaacST08 Jan 27, 2025
06fbacb
Added enum options for completion matcher option
isaacST08 Jan 30, 2025
b4098ad
Added chktex options for texlab
isaacST08 Jan 30, 2025
0c3c67d
Added symbol options for texlab
isaacST08 Jan 30, 2025
35430ca
Cleanup: Sorted sections alphabetically, utilized inherrits where app…
isaacST08 Jan 30, 2025
4b2d169
Further Cleanup
isaacST08 Jan 30, 2025
ac062b2
Created PDF viewer framework
isaacST08 Jan 31, 2025
892f3d6
PDF Viewer framework bug fixes and integrated functionallity into tex…
isaacST08 Jan 31, 2025
4a581e9
Added more pdf viewer options
isaacST08 Jan 31, 2025
594d7b4
Reorganized file and options structure for more intuitive use
isaacST08 Jan 31, 2025
08a7748
Fixed typos and formatting
isaacST08 Feb 10, 2025
b30727e
Created mkEnableTreesitterOption in the extendend library
isaacST08 Feb 11, 2025
3c8fde8
Rebase & Merge
isaacST08 Feb 12, 2025
44c007f
Added usage of lib.optionals and created an assersion to check the nu…
isaacST08 Feb 12, 2025
29d7815
Added code/keyword md escaping for documentation in modules/plugins/l…
isaacST08 Feb 12, 2025
290f4e5
Added code/keyword md escaping for documentation in modules/plugins/l…
isaacST08 Feb 12, 2025
937f48d
Removed duplicate "Whether to enable" in documentation for modules/pl…
isaacST08 Feb 12, 2025
6c3efb5
Removed duplicate "Whether to enable" in documentation for modules/pl…
isaacST08 Feb 12, 2025
6a80573
Clarified documentation wording and utilized mkPackageOption for the …
isaacST08 Feb 12, 2025
123027e
Created assertion for the correct number of pdf viewers instead of th…
isaacST08 Feb 12, 2025
e640fef
Cleaned up documentation and other performed other code cleanups
isaacST08 Feb 12, 2025
2e326bd
Utilized lib.optionalAttrs to simplify code
isaacST08 Feb 12, 2025
d643334
Added comment explaining why code is structured as it is
isaacST08 Feb 12, 2025
bd90630
Cleaned up tectonic args processing
isaacST08 Feb 12, 2025
1275231
Reword doc description
isaacST08 Feb 12, 2025
af04bec
Altered mkEnableTreesitterOption functionallity to take in a boolean …
isaacST08 Feb 12, 2025
9211746
Changed the new-file-template-nvim npin to the fork that adds escapin…
isaacST08 Feb 18, 2025
3859b8d
Fixed missing mkOption function call in tectonic.nix
isaacST08 Mar 7, 2025
2393647
Fixed typo in default.nix
isaacST08 Mar 7, 2025
f57dbd0
Fixed typo in tectonic.nix
isaacST08 Mar 7, 2025
d65c480
Started work to resolve infrec error
isaacST08 Mar 10, 2025
3433bf9
Refactored pdfViewer and fixed infrec error
isaacST08 May 4, 2025
353b63b
Added description for pdf viewer
isaacST08 May 4, 2025
4d80eeb
Changed lsp enable config variable referenced
isaacST08 Nov 15, 2025
0da99e0
Removed builderTemplate implementation in favour of an inline approach
isaacST08 Dec 19, 2025
0e3fc24
Simplified pdfViewer configuration implementation
isaacST08 Dec 20, 2025
2334909
Updated texlab lsp to reference and respect the pdfViewer options
isaacST08 Dec 20, 2025
d104e38
Migrated lsp configs to new standard (non-lspconfig)
isaacST08 Dec 20, 2025
dc5a2b8
Reimplemented formatters
isaacST08 Dec 20, 2025
bbf7ea6
Fixed typo in modules/plugins/languages/tex/formatter.nix
isaacST08 Dec 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/manual/configuring/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ languages have sections under the `vim.languages` attribute.
[vim.languages.tailwind.enable](./options.html#option-vim-languages-tailwind-enable)
- Terraform:
[vim.languages.terraform.enable](./options.html#option-vim-languages-terraform-enable)
- Tex:
[vim.languages.tex.enable](./options.html#option-vim-languages-tex-enable)
- Typst:
[vim.languages.typst.enable](./options.html#option-vim-languages-typst-enable)
- Vala:
Expand Down
2 changes: 1 addition & 1 deletion lib/types/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
in {
inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
inherit (typesLanguage) diagnostics mkGrammarOption;
inherit (typesLanguage) diagnostics mkGrammarOption mkEnableTreesitterOption;
inherit (customTypes) char hexColor mergelessListOf deprecatedSingleOrListOf;
}
11 changes: 9 additions & 2 deletions lib/types/languages.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{lib}: let
inherit (lib.options) mkOption mkPackageOption;
inherit (lib.attrsets) attrNames;
inherit (lib.types) listOf either enum submodule package;
inherit (lib.types) listOf either enum submodule package bool;

diagnosticSubmodule = _: {
options = {
Expand Down Expand Up @@ -32,6 +32,13 @@
mkPackageOption pkgs ["${grammar} treesitter"] {
default = ["vimPlugins" "nvim-treesitter" "builtGrammars" grammar];
};

mkEnableTreesitterOption = defaultCondition: language:
mkOption {
type = bool;
default = defaultCondition;
description = "Whether to enable ${language} treesitter";
};
in {
inherit diagnostics diagnosticSubmodule mkGrammarOption;
inherit diagnostics diagnosticSubmodule mkGrammarOption mkEnableTreesitterOption;
}
1 change: 1 addition & 0 deletions modules/plugins/languages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ in {
./svelte.nix
./tailwind.nix
./terraform.nix
./tex
./ts.nix
./typst.nix
./zig.nix
Expand Down
69 changes: 69 additions & 0 deletions modules/plugins/languages/tex/build/builders/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) enum listOf package str;
inherit (builtins) attrNames;

cfg = config.vim.languages.tex;
in {
imports = [
./latexmk.nix
./tectonic.nix
];

options.vim.languages.tex.build.builder = {
name = mkOption {
type = enum (attrNames cfg.build.builders);
default = "latexmk";
description = ''
The tex builder to use.

This is just the default custom option. By setting any of the
builders to true, this will be overwritten by that builder's
parameters.
Setting this parameter to the name of a declared builder will
not automatically enable that builder.
'';
};
args = mkOption {
type = listOf str;
default = [
"-pdf"
"%f"
];
description = ''
The list of args to pass to the builder.

This is just the default custom option. By setting any of the
builders to true, this will be overwritten by that builder's
parameters.
'';
};
package = mkOption {
type = package;
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
description = ''
The tex builder package to use.

This is just the default custom option. By setting any of the
builders to true, this will be overwritten by that builder's
parameters.
'';
};
executable = mkOption {
type = str;
default = "latexmk";
description = ''
The tex builder executable to use.

This is just the default custom option. By setting any of the
builders to true, this will be overwritten by that builder's
parameters.
'';
};
};
}
57 changes: 57 additions & 0 deletions modules/plugins/languages/tex/build/builders/latexmk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# TODO: I need testing.
{
config,
lib,
pkgs,
...
}: let
# The name of the builder
name = "latexmk";

inherit (lib.modules) mkIf;
inherit (lib.nvim.config) mkBool;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) package str;

texCfg = config.vim.languages.tex;
cfg = texCfg.build.builders.${name};
in {
options.vim.languages.tex.build.builders.${name} = {
enable = mkEnableOption "Tex Compilation Via latexmk";

package = mkOption {
type = package;
default = pkgs.texlive.withPackages (ps: [ps.latexmk]);
description = "latexmk package";
};

executable = mkOption {
type = str;
default = "latexmk";
description = ''
The executable name from the build package that will be used to
build/compile the tex.
'';
};

# Flag options
pdfOutput = mkBool true "Insure the output file is a pdf.";
};

config = mkIf (texCfg.enable && cfg.enable) {
vim.languages.tex.build.builder = {
inherit name;
inherit (cfg) package executable;

args = (
# Flags
(lib.lists.optional cfg.pdfOutput "-pdf")
# Base args
++ [
"-quiet"
"%f"
]
);
};
};
}
184 changes: 184 additions & 0 deletions modules/plugins/languages/tex/build/builders/tectonic.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
config,
lib,
pkgs,
...
}: let
# The name of the builder
name = "tectonic";

inherit (builtins) concatLists elem map toString match;
inherit (lib.modules) mkIf;
inherit (lib.nvim.config) mkBool;
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
inherit (lib.strings) toLower optionalString stringAsChars;
inherit (lib.types) enum ints listOf str nullOr;

texCfg = config.vim.languages.tex;
cfg = texCfg.build.builders.${name};
in {
options.vim.languages.tex.build.builders.${name} = {
enable = mkEnableOption "Tex Compilation Via Tectonic";

package = mkPackageOption pkgs "tectonic" {};

executable = mkOption {
type = str;
default = "tectonic";
description = ''
The executable name from the build package that will be used to
build/compile the tex.
'';
};

# -- Flags --
keepIntermediates = mkBool false ''
Whether to keep the intermediate files generated during processing.

If texlab is reporting build errors when there shouldn't be, disable
this option.
'';
keepLogs = mkBool true ''
Whether to keep the log files generated during processing.

Without the keepLogs flag, texlab won't be able to report compilation
warnings.
'';
onlyCached = mkBool false ''
Whether to use only resource files cached locally
'';
synctex = mkBool true "Whether to generate SyncTeX data";
untrustedInput = mkBool false ''
Whether to disable all known-insecure features if the input is untrusted
'';

# -- Options --
reruns = mkOption {
type = ints.unsigned;
default = 0;
example = 2;
description = ''
How many times to *rerun* the TeX build engine.
The build engine (if a builder is enabled) will always run at least
once.

Setting this value to 0 will disable setting this option.
'';
};

bundle = mkOption {
type = nullOr str;
default = null;
description = ''
The directory or Zip-format bundle file to find resource files instead
of the default.
'';
};

webBundle = mkOption {
type = nullOr str;
default = null;
description = ''
Use this URL to find resource files instead of the default.
'';
};

outfmt = mkOption {
type = nullOr (enum [
"pdf"
"html"
"xdv"
"aux"
"fmt"
]);
default = null;
description = ''
The kind of output to generate.

Setting this to `null` (default) will let tectonic decide the most
appropriate output format, which usually be a pdf.
'';
};

hidePaths = mkOption {
type = listOf str;
default = [];
example = [
"./secrets.tex"
"./passwords.tex"
];
description = ''
Tell the engine that no file at `<path/to/hide>` exists, if it tries
to read it.
'';
};

format = mkOption {
type = nullOr str;
default = null;
description = ''
The name of the \"format\" file used to initialize the TeX engine.
'';
};

color = mkOption {
type = nullOr (enum [
"always"
"auto"
"never"
]);
default = null;
example = "always";
description = "Enable/disable colorful log output";
};

extraOptions = mkOption {
type = listOf str;
default = [];
description = ''
Add extra command line options to include in the tectonic build
command.
Extra options added here will not overwrite the options set in as nvf
options.
'';
};
};

config = mkIf (texCfg.enable && cfg.enable) {
vim.languages.tex.build.builder = {
inherit name;
inherit (cfg) package executable;

args = let
inherit (lib.lists) optional optionals;
snakeCaseToKebabCase = str: stringAsChars (x: "${optionalString ((match "[A-Z]" x) != null) "-"}${toLower x}") str;
generateOptionFlag = option: (optionals (cfg.${option} != "" && cfg.${option} != null) ["--${snakeCaseToKebabCase option}" "${toString cfg.${option}}"]);
in (
# Base args
[
"-X"
"compile"
"%f"
]
# Flags
++ (optional cfg.keepIntermediates "--keep-intermediates")
++ (optional cfg.keepLogs "--keep-logs")
++ (optional cfg.onlyCached "--only-cached")
++ (optional cfg.synctex "--synctex")
++ (optional cfg.untrustedInput "--untrusted")
# Options
++ (optionals (cfg.reruns > 0) ["--reruns" "${toString cfg.reruns}"])
++ (generateOptionFlag "bundle")
++ (generateOptionFlag "webBundle")
++ (generateOptionFlag "outfmt")
++ (concatLists (map (x: ["--hide" x]) cfg.hidePaths))
++ (generateOptionFlag "format")
++ (generateOptionFlag "color")
# Still options but these are not defined by builder specific options but
# instead synchronize options between the global build options and builder
# specific options.
++ (optionals (!(elem texCfg.build.pdfDirectory ["." ""])) ["--outdir" "${texCfg.build.pdfDirectory}"])
);
};
};
}
Loading
Loading