https://github.com/franco-ruggeri/pdf-preview.nvim
Neovim plugin for live PDF preview - LaTeX workflow in containers
https://github.com/franco-ruggeri/pdf-preview.nvim
containers latex neovim neovim-lua neovim-plugin
Last synced: 4 months ago
JSON representation
Neovim plugin for live PDF preview - LaTeX workflow in containers
- Host: GitHub
- URL: https://github.com/franco-ruggeri/pdf-preview.nvim
- Owner: franco-ruggeri
- License: mit
- Created: 2025-06-05T22:33:34.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-06-29T07:42:31.000Z (4 months ago)
- Last Synced: 2025-06-29T08:19:28.116Z (4 months ago)
- Topics: containers, latex, neovim, neovim-lua, neovim-plugin
- Language: Lua
- Homepage:
- Size: 1.99 MB
- Stars: 7
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PDF Preview π§Ύπ
## π Overview
A Neovim plugin for easily previewing PDF documents in your browser, with
automatic reloading on file changes. This plugin is ideal for a minimalist LaTeX
editing workflow, even on a remote server or in a dev container.
## β¨ Features
- π Auto-reloading: Refreshes the browser when your PDF file changes.
- π Remote-friendly: Works over SSH with port forwarding.
- πͺ Transparent: No side effects in your project.
- βοΈ Minimal config: Simple `setup()` with sensible defaults.## β‘ Requirements
- Node.js (for `npm` and `npx`)
## π¦ Installation
Using [lazy.nvim](https://github.com/folke/lazy.nvim) :
```lua
{
"franco-ruggeri/pdf-preview.nvim",
opts = {
-- Override defaults here
}
config = function(_, opts)
require("pdf-preview").setup(opts)-- Add your keymaps here
end
}
```## π Usage
The following user commands are created:
- `:PdfPreviewStart` : Start PDF preview.
- `:PdfPreviewStop` : Stop PDF preview.
- `:PdfPreviewToggle` : Toggle PDF preview.After using `:PdfPreviewStart`, open the printed URL (e.g.,
) in your browser.## π οΈ Configuration
The default configuration is as follows:
```lua
{
-- Port where the browser-sync server will try to listen on.
-- If nil, the default browser-sync behavior will be followed.
port = nil,
-- Debounce delay for refresh events in milliseconds
reload_debouce = 500,
}
```## π‘ Workflow Tips
### π§ͺ LaTeX
This plugin works nicely with LaTeX. Just compile the LaTeX project into a PDF
document.For instance, you can:
- Install the `texlab` LSP server using `mason.nvim`.
- Configure `texlab` to compile on save.```lua
vim.lsp.config("texlab", {
settings = {
texlab = {
build = {
onSave = true,
},
},
},
})
```The `texlab` LSP server will take care of compiling on save, and `pdf-preview`
will watch for changes in the output PDF document.### π Remote server
You can use SSH port forwarding to view the PDF remotely:
```bash
ssh -L :localhost: @
```### π³ Dev container
You can use port forwarding by setting the `forwardPorts` property. See the
[official documentation](https://containers.dev/implementors/json_reference/).## π€ Contributing
All contributions are welcome! Open an issue to discuss ideas and open a pull
request once agreed.