No description
* feat(presets): add pdflatex preset Adds a direct pdflatex preset for users who want single-pass compilation without latexmk orchestration. Uses -file-line-error for parseable diagnostics and reuses the existing parse_latexmk error parser since both emit the same file:line: message format. * feat(presets): add tectonic preset Adds a tectonic preset for the modern Rust-based LaTeX engine, which auto-downloads packages and requires no TeX installation. Reuses parse_latexmk since tectonic emits the same file:line: message diagnostic format. * feat(presets): add asciidoctor preset Adds an asciidoctor preset for AsciiDoc → HTML compilation with SSE live-reload. Includes a parse_asciidoctor error parser handling the "asciidoctor: SEVERITY: file: line N: message" format for both ERROR and WARNING diagnostics. * feat(presets): add quarto preset Adds a quarto preset for .qmd scientific documents rendering to self-contained HTML with SSE live-reload. Uses --embed-resources to avoid a _files directory in the common case. No error_parser since quarto errors are heterogeneous (mixed R/Python/pandoc output). * refactor: apply stylua formatting to new preset code |
||
|---|---|---|
| .github/workflows | ||
| doc | ||
| lua/preview | ||
| plugin | ||
| spec | ||
| .busted | ||
| .editorconfig | ||
| .gitignore | ||
| .luarc.json | ||
| .prettierrc | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| preview.nvim-scm-1.rockspec | ||
| README.md | ||
| selene.toml | ||
| stylua.toml | ||
| vim.yaml | ||
preview.nvim
Async document compilation for Neovim
An extensible framework for compiling documents (LaTeX, Typst, Markdown, etc.) asynchronously with error diagnostics.
Features
- Async compilation via
vim.system() - Built-in presets for Typst, LaTeX, Markdown, and GitHub-flavored Markdown
- Compiler errors as native
vim.diagnostic - User events for extensibility (
PreviewCompileStarted,PreviewCompileSuccess,PreviewCompileFailed)
Requirements
- Neovim 0.11+
Installation
Install with your package manager of choice or via luarocks:
luarocks install preview.nvim
Documentation
:help preview.nvim
FAQ
Q: How do I define a custom provider?
require('preview').setup({
typst = {
cmd = { 'typst', 'compile' },
args = function(ctx)
return { ctx.file }
end,
output = function(ctx)
return ctx.file:gsub('%.typ$', '.pdf')
end,
},
})
Q: How do I override a preset?
require('preview').setup({
typst = { env = { TYPST_FONT_PATHS = '/usr/share/fonts' } },
})
Q: How do I automatically open the output file?
Set open = true on your provider (all built-in presets have this enabled) to
open the output with vim.ui.open() after the first successful compilation. For
a specific application, pass a command table:
require('preview').setup({
typst = { open = { 'sioyek', '--new-instance' } },
})