feat(compiler): add TeXpresso integration#3267
Open
SeniorMars wants to merge 4 commits into
Open
Conversation
Add a VimTeX compiler backend for TeXpresso, a live-rendering LaTeX tool that updates the preview incrementally as the buffer changes. The backend communicates with TeXpresso through its JSON protocol over stdio and supports SyncTeX forward/inverse search, quickfix integration, and live buffer synchronization. Neovim buffer synchronization is handled through lua/vimtex/compiler/texpresso.lua. This revives the work from PR lervag#2975 and addresses the main review comments from that discussion: - Move the Neovim buffer-attach Lua code to lua/vimtex/compiler/texpresso.lua, with type annotations and a defensive check for compiler state during shutdown or reload. - Add documentation in doc/vimtex.txt modeled on the existing compiler backend sections, including a Requirements block and option docs. - Internalize the required -json and -lines flags so users cannot accidentally break the protocol by editing g:vimtex_compiler_texpresso. - Normalize passed_options spacing in __build_cmd with trim() so the function is robust regardless of whether the caller includes a leading space. - Add a stdin_pipe flag to the compiler template so that only TeXpresso enables stdin piping for its job, rather than changing the default for all continuous compiler backends. - Register texpresso in the valid compiler methods list in compiler.vim. - Add tests (test/test-compiler-texpresso/): - Unit tests (`make` / `make vim`) verify stdin_pipe, continuous mode, __build_cmd output, and passed_options spacing without requiring TeXpresso to be installed. These run under both Neovim and Vim. - Integration smoke test (`make integration`) starts a real TeXpresso process under Neovim, sends a reload message, and verifies that it stops cleanly. Note: I'm a bit unfamiliar with the vim codebase, so additional tests may be needed; however, neovim has been tested. Co-Authored-By: Tsung-Ju Chiang <71379180+tsung-ju@users.noreply.github.com>
lervag
reviewed
May 18, 2026
Owner
There was a problem hiding this comment.
Thanks! This seems to be a good PR, and I only have a couple of minor code comments.
Note: I'm a bit unfamiliar with the vim codebase, so additional tests may be needed; however, neovim has been tested.
Thanks! I can probably test this with Vim when I get the time. I'm assuming that it should be easy to install texpresso on Arch Linux (which seems to be the case).
Is there anything specific you would advice me to test before accepting this?
| Compiler backend ~ | ||
|
|
||
| VimTeX uses `latexmk`, `latexrun`, `tectonic` or `arara` to compile the LaTeX document. | ||
| VimTeX uses `latexmk`, `latexrun`, `tectonic`, `arara` or `texpresso` to compile the LaTeX document. |
Owner
There was a problem hiding this comment.
Please restrict to 79 characters per row in this file.
| augroup END | ||
|
|
||
| if has('nvim') | ||
| let self.nvim_detach = s:nvim_attach() |
Owner
There was a problem hiding this comment.
I'm curious, why don't we inline the luaeval here instead of running it in line 44 at module load time?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a VimTeX compiler backend for TeXpresso, a live-rendering LaTeX tool that updates the preview incrementally as the buffer changes. The backend communicates with TeXpresso through its JSON protocol over stdio and supports SyncTeX forward/inverse search, quickfix integration, and live buffer synchronization. Neovim buffer synchronization is handled through lua/vimtex/compiler/texpresso.lua.
This revives the work from PR #2975 and addresses the main review comments from that discussion:
make/make vim) verify stdin_pipe, continuous mode, __build_cmd output, and passed_options spacing without requiring TeXpresso to be installed. These run under both Neovim and Vim.make integration) starts a real TeXpresso process under Neovim, sends a reload message, and verifies that it stops cleanly.Note: I'm a bit unfamiliar with the vim codebase, so additional tests may be needed; however, neovim has been tested.
Co-Authored-By: Tsung-Ju Chiang 71379180+tsung-ju@users.noreply.github.com