From 8e15fc1902e5078bb1c1f6f89fa0ddefb91f7b3d Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Tue, 29 Oct 2024 23:05:19 -0700 Subject: [PATCH] feat: add latex support with texpresso and texlab --- flake.nix | 2 ++ indent.log | 31 +++++++++++++++++++++++++++++++ lua/lsp/init.lua | 1 + lua/plugins/by-lang/latex.lua | 8 ++++++++ lua/plugins/conform.lua | 1 + lua/plugins/lz-spec.lua | 1 + 6 files changed, 44 insertions(+) create mode 100644 indent.log create mode 100644 lua/plugins/by-lang/latex.lua diff --git a/flake.nix b/flake.nix index 254ac36..c54cf50 100644 --- a/flake.nix +++ b/flake.nix @@ -175,6 +175,7 @@ lsp_lines-nvim vim-sleuth typescript-tools-nvim + texpresso-vim ]; }; @@ -204,6 +205,7 @@ bin = { websocat = "${pkgs.websocat}/bin/websocat"; tinymist = "${pkgs.tinymist}/bin/tinymist"; + texpresso = "${pkgs.texpresso}/bin/texpresso"; }; nixdExtras = { nixpkgs = inputs.nixpkgs.outPath; diff --git a/indent.log b/indent.log new file mode 100644 index 0000000..dd541ad --- /dev/null +++ b/indent.log @@ -0,0 +1,31 @@ +INFO: latexindent.pl version 3.23.6, 2024-01-17, a script to indent .tex files + latexindent.pl lives here: /nix/store/dg0j7w9wrsdrrrnzyr4akibajm2qfixs-latexindent-3.23.6-tex/scripts/latexindent/ + Tue Oct 29 23:04:51 2024 + Reading input from STDIN +INFO: Processing switches: +INFO: Directory for backup files and indent.log: + . +INFO: Perl modules are being loaded from the following directories: + /nix/store/mnnp3qlmkwgzl3lbnz7qlaqddwjjwa7v-perl-5.40.0/lib/perl5/5.40.0/FindBin.pm + /nix/store/084zikfymlc0xadd0r0da714cf48p0ri-perl-5.40.0-env/lib/perl5/site_perl/5.40.0/YAML/Tiny.pm + /nix/store/mnnp3qlmkwgzl3lbnz7qlaqddwjjwa7v-perl-5.40.0/lib/perl5/5.40.0/File/Copy.pm + /nix/store/mnnp3qlmkwgzl3lbnz7qlaqddwjjwa7v-perl-5.40.0/lib/perl5/5.40.0/File/Basename.pm + /nix/store/mnnp3qlmkwgzl3lbnz7qlaqddwjjwa7v-perl-5.40.0/lib/perl5/5.40.0/Getopt/Long.pm + /nix/store/084zikfymlc0xadd0r0da714cf48p0ri-perl-5.40.0-env/lib/perl5/site_perl/5.40.0/File/HomeDir.pm +INFO: LatexIndent perl modules are being loaded from, for example: + /nix/store/dg0j7w9wrsdrrrnzyr4akibajm2qfixs-latexindent-3.23.6-tex/scripts/latexindent/LatexIndent/Document.pm +INFO: YAML settings read: defaultSettings.yaml + Reading defaultSettings.yaml from /nix/store/dg0j7w9wrsdrrrnzyr4akibajm2qfixs-latexindent-3.23.6-tex/scripts/latexindent/defaultSettings.yaml +INFO: YAML reading settings + Home directory is /home/youwen + latexindent.pl didn't find indentconfig.yaml or .indentconfig.yaml + see all possible locations: https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html#indentconfig-options) +INFO: Phase 1: searching for objects +INFO: Phase 2: finding surrounding indentation +INFO: Phase 3: indenting objects +INFO: Phase 4: final indentation check +INFO: Output routine: + Not outputting to file; see -w and -o switches for more options. + -------------- +INFO: Please direct all communication/issues to: + https://github.com/cmhughes/latexindent.pl diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 527d466..d446f25 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -61,6 +61,7 @@ M.setup = function() lspconfig.tinymist.setup({}) lspconfig.svelte.setup({}) lspconfig.tailwindcss.setup({}) + lspconfig.texlab.setup({}) end return M diff --git a/lua/plugins/by-lang/latex.lua b/lua/plugins/by-lang/latex.lua new file mode 100644 index 0000000..64ee969 --- /dev/null +++ b/lua/plugins/by-lang/latex.lua @@ -0,0 +1,8 @@ +return { + "texpresso.vim", + filetypes = { "*.tex" }, + cmd = { "TeXpresso" }, + after = function() + require("texpresso").texpresso_path = nixCats("bin.texpresso") + end, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index ef6e76f..77ed8ed 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -64,6 +64,7 @@ return { yaml = { "prettierd", "prettier", stop_after_first = true }, typst = { "typstyle" }, svelte = { "prettier" }, + tex = { "latexindent" }, }, }) diff --git a/lua/plugins/lz-spec.lua b/lua/plugins/lz-spec.lua index d94cbe6..531d81b 100644 --- a/lua/plugins/lz-spec.lua +++ b/lua/plugins/lz-spec.lua @@ -11,6 +11,7 @@ return { require("plugins.trouble"), require("plugins.render-markdown"), require("plugins.toggleterm"), + require("plugins.by-lang.latex"), { "telescope-ui-select.nvim" }, { "vim-wakatime" }, { "vim-sleuth" },