No description
Find a file
Barrett Ruth bb9ca987e1
Some checks are pending
luarocks / quality (push) Waiting to run
luarocks / publish (push) Blocked by required conditions
Add note about previewer auto-close feature
2026-03-04 19:12:33 -05:00
.github/workflows ci: format 2026-03-01 17:22:59 -05:00
doc fix(compiler): defer open until successful compile, close viewer on :bd (#38) 2026-03-04 15:48:30 -05:00
lua/preview fix: quickfix support for long-running providers (#41) 2026-03-04 17:23:06 -05:00
plugin feat: rename 2026-03-02 21:23:40 -05:00
scripts fix(ci): use absolute path for lua-language-server --configpath (#34) 2026-03-04 14:33:25 -05:00
spec fix: quickfix support for long-running providers (#41) 2026-03-04 17:23:06 -05:00
.busted ci: format 2026-03-01 17:22:59 -05:00
.editorconfig ci: format 2026-03-01 17:22:59 -05:00
.gitignore ci: format 2026-03-01 17:22:59 -05:00
.luarc.json fix(ci): resolve lua-language-server warnings (#32) 2026-03-04 14:28:52 -05:00
.prettierrc ci: format 2026-03-01 17:22:59 -05:00
.styluaignore ci: scripts (#31) 2026-03-04 14:23:38 -05:00
flake.lock ci: format 2026-03-01 17:22:59 -05:00
flake.nix fix(ci): resolve lua-language-server warnings (#32) 2026-03-04 14:28:52 -05:00
LICENSE ci: format 2026-03-01 17:22:59 -05:00
preview.nvim-scm-1.rockspec feat: rename 2026-03-02 21:23:40 -05:00
README.md Add note about previewer auto-close feature 2026-03-04 19:12:33 -05:00
selene.toml ci: format 2026-03-01 17:25:34 -05:00
stylua.toml ci: format 2026-03-01 17:22:59 -05:00
vim.yaml ci: format 2026-03-01 17:22:59 -05:00

preview.nvim

Universal document previewer for Neovim

An extensible framework for compiling and previewing any documents (LaTeX, Typst, Markdown, etc.)—diagnostics included.

Features

  • Async compilation via vim.system()
  • Built-in presets for Typst, LaTeX (latexmk, pdflatex, tectonic), Markdown, GitHub-flavored Markdown, AsciiDoc, and Quarto
  • Compiler errors via vim.diagnostic or quickfix
  • Previewer auto-close on buffer deletion

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({
  rst = {
    cmd = { 'rst2html' },
    args = function(ctx)
      return { ctx.file, ctx.output }
    end,
    output = function(ctx)
      return ctx.file:gsub('%.rst$', '.html')
    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 in toggle/watch mode. For a specific application, pass a command table:

require('preview').setup({
  typst = { open = { 'sioyek', '--new-instance' } },
})