Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Tex Language Support #569

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
33ccc42
Created tex language options
isaacST08 Jan 19, 2025
9cded6f
Fix import on the wrong line
isaacST08 Jan 19, 2025
a504d8e
Added toString functions on Texlab LSP source booleans and other mapp…
isaacST08 Jan 19, 2025
97b4dd8
Fixed typo
isaacST08 Jan 19, 2025
23f2b22
Created function to simplify converting a string into lua format and …
isaacST08 Jan 19, 2025
7744a1a
Fixed weird nix boolean toString implementation
isaacST08 Jan 19, 2025
9811174
Changed texlab lsp config build.filename to use stringToLua function
isaacST08 Jan 19, 2025
3897764
Added tex to the languages list
isaacST08 Jan 19, 2025
5883c09
Fixed texlab needing to be installed globally to be able to use the lsp
isaacST08 Jan 19, 2025
c002e8f
Merge pull request #570 from LilleAila/add-rainbow-delimiters
NotAShelf Jan 19, 2025
c191420
Added support for setting the g:tex_flavor option
isaacST08 Jan 19, 2025
fb0ddb3
Switched to Alejandra formatting style
isaacST08 Jan 19, 2025
4db392f
Merge branch 'NotAShelf:main' into feature-language-tex
isaacST08 Jan 19, 2025
cd05271
Tex templates were broken in the current version of the new-file-temp…
isaacST08 Jan 22, 2025
3c50372
Merge branch 'feature-language-tex' of github:isaacST08/nvf into feat…
isaacST08 Jan 22, 2025
9357bde
Added texlab tectonic options
isaacST08 Jan 23, 2025
1f08c4e
Starting modularizing tex.nix into smaller sections
isaacST08 Jan 23, 2025
c3291ab
Moved lsp config into its own module
isaacST08 Jan 23, 2025
9b401be
Migrated texlab into its own module
isaacST08 Jan 23, 2025
48674a4
Cleanup residue from modularization
isaacST08 Jan 24, 2025
44959a0
Created build module
isaacST08 Jan 24, 2025
9b524fb
Cleanup after makeing build module
isaacST08 Jan 24, 2025
13da2ae
Fixed typo
isaacST08 Jan 24, 2025
1d28982
Merge branch 'NotAShelf:main' into feature-language-tex
isaacST08 Jan 24, 2025
387eb9b
Created builder template for making new builders that will work with …
isaacST08 Jan 24, 2025
aef8284
Created latexmk builder
isaacST08 Jan 24, 2025
a8cd1af
Pinned commit hash of new-file-template.nvim
isaacST08 Jan 25, 2025
ca9ab42
Switched to using lib.nvim.config.mkBool where appropriate
isaacST08 Jan 26, 2025
1bebf49
Refactored to use the nvf library toLuaObject as well as other improv…
isaacST08 Jan 27, 2025
934eed8
Added diagnostic options for texlab
isaacST08 Jan 27, 2025
c2796c9
Added general texlab options and some cleanup
isaacST08 Jan 27, 2025
68c3610
Added latexindent options to texlab
isaacST08 Jan 27, 2025
e518c8e
Added completion options for texlab
isaacST08 Jan 27, 2025
6a023fc
Added inlayHints options for texlab and some cleanup
isaacST08 Jan 27, 2025
83bfc28
Added experimental options for texlab
isaacST08 Jan 27, 2025
8f33313
Removed old files
isaacST08 Jan 27, 2025
95d5463
Merge branch 'NotAShelf:main' into feature-language-tex
isaacST08 Jan 27, 2025
637170b
Added enum options for completion matcher option
isaacST08 Jan 30, 2025
19bbdef
Added chktex options for texlab
isaacST08 Jan 30, 2025
0828367
Added symbol options for texlab
isaacST08 Jan 30, 2025
650775e
Cleanup: Sorted sections alphabetically, utilized inherrits where app…
isaacST08 Jan 30, 2025
00c3568
Further Cleanup
isaacST08 Jan 30, 2025
9524d93
Created PDF viewer framework
isaacST08 Jan 31, 2025
95a0125
PDF Viewer framework bug fixes and integrated functionallity into tex…
isaacST08 Jan 31, 2025
821cefe
Added more pdf viewer options
isaacST08 Jan 31, 2025
e08d0b5
Reorganized file and options structure for more intuitive use
isaacST08 Jan 31, 2025
88aa581
Merge branch 'NotAShelf:main' into feature-language-tex
isaacST08 Jan 31, 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
1 change: 1 addition & 0 deletions docs/manual/configuring/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ formatting to diagnostics. The following languages have sections under the
- Go: [vim.languages.go.enable](#opt-vim.languages.go.enable)
- Lua: [vim.languages.lua.enable](#opt-vim.languages.lua.enable)
- PHP: [vim.languages.php.enable](#opt-vim.languages.php.enable)
- Tex: [vim.languages.tex.enable](#opt-vim.languages.tex.enable)

Adding support for more languages, and improving support for existing ones are
great places where you can contribute with a PR.
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
isaacST08 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@

plugin-new-file-template-nvim = {
# (required by new-file-template.nvim)
url = "github:otavioschwanck/new-file-template.nvim";
url = "github:isaacST08/new-file-template.nvim?rev=dc3a58b1f490c86075c96670b9eb81370c2f2ca1";
flake = false;
};

Expand Down
21 changes: 11 additions & 10 deletions modules/plugins/languages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,42 @@ in {
./asm.nix
./astro.nix
./bash.nix
./dart.nix
./clang.nix
./csharp.nix
./css.nix
./dart.nix
./elixir.nix
./gleam.nix
./go.nix
./haskell.nix
./hcl.nix
./kotlin.nix
./html.nix
./haskell.nix
./java.nix
./julia.nix
./kotlin.nix
./lua.nix
./markdown.nix
./nim.nix
./vala.nix
./nix.nix
./nu.nix
./ocaml.nix
./odin.nix
./php.nix
./python.nix
./r.nix
./ruby.nix
./rust.nix
./scala.nix
./sql.nix
./svelte.nix
./tailwind.nix
./terraform.nix
./tex
./ts.nix
./typst.nix
./zig.nix
./csharp.nix
./julia.nix
./nu.nix
./odin.nix
./vala.nix
./wgsl.nix
./ruby.nix
./zig.nix
];

options.vim.languages = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This function acts as a template for creating new builders.
# It enforces providing all the parameters required for creating
# a new builder for it to be able to work in the existing code.
#
# The first layer requirements are as follows:
{
# This is the name of the builder, it will only be used internally and
# should match the <name>.nix file that the builder is implemented in.
name,
#
# Module attribute set. This is the attribute set that the module that is
# defining a builder is passed as its input.
moduleInheritencePackage,
#
# These are the standard options for the builder just like creating any
# other module. Some options are required and are described below but
# it will also accept any other options that are provided to it.
options,
#
# These are the command line arguments that will accompany the executable
# when the build command is called.
# This is a function that will take in the cfg of its own builder.
# i.e. will be called as "args cfg.build.builders.${name}"
args,
...
}: let
# Inherit the necessary variables available to any module.
inherit (moduleInheritencePackage) lib config;
#
# Inherit other useful functions.
inherit (lib.modules) mkIf;
#
# Set the cfg variable
cfg = config.vim.languages.tex;
in {
# These are the options for the builder. It will accept any options
# provided to it but some options are mandatory:
options.vim.languages.tex.build.builders.${name} = ({
# The enable option. This one is self explanatory.
enable,
#
# This is the package option for the builder.
package,
#
# This is the executable that will be used to call the builder.
# It, along with package will result in:
# "<package_path>/bin/<executable>"
executable,
#
# Any other options provided are accepted.
...
} @ opts:
opts)
options;

# Check that the language and this builder have been enabled
# before making any config.
config = mkIf (cfg.enable && cfg.build.builders.${name}.enable) {
vim.languages.tex.build.builder = {
inherit name;
package = cfg.build.builders.${name}.package;
executable = cfg.build.builders.${name}.executable;
args = args cfg.build.builders.${name};
};
};
}
70 changes: 70 additions & 0 deletions modules/plugins/languages/tex/build/builders/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) enum listOf package str;
inherit (lib.nvim.config) mkBool;
inherit (builtins) attrNames filter isAttrs hasAttr elemAt length;

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.
{
pkgs,
lib,
...
} @ moduleInheritencePackage: let

Check warning on line 6 in modules/plugins/languages/tex/build/builders/latexmk.nix

View workflow job for this annotation

GitHub Actions / check-typos

"Inheritence" should be "Inheritance".
# The name of the builder
name = "latexmk";

# The builder template
template = import ./builderTemplate.nix;

inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool package str;
in (
template {
inherit name moduleInheritencePackage;

Check warning on line 17 in modules/plugins/languages/tex/build/builders/latexmk.nix

View workflow job for this annotation

GitHub Actions / check-typos

"Inheritence" should be "Inheritance".

options = {
enable = mkEnableOption "Whether to enable 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 = mkOption {
type = bool;
default = true;
example = false;
description = "Insure the output file is a pdf.";
};
};

args = builderCfg: (
# Flags
(
if builderCfg.pdfOutput
then ["-pdf"]
else []
)
# Base args
++ [
"-quiet"
"%f"
]
);
}
)
Loading
Loading