Skip to content

Instantly share code, notes, and snippets.

@sieste
Created February 22, 2025 21:20
Show Gist options
  • Save sieste/a544337dbc746405127317b3a77ecafc to your computer and use it in GitHub Desktop.
Save sieste/a544337dbc746405127317b3a77ecafc to your computer and use it in GitHub Desktop.
Neovim/typst/mupdf setup for real time pdf editing

My neovim + typst + mupdf setup for real-time pdf editing

  • open typst source in neovim:

nvim main.typ

  • open typst watch in a separate terminal buffer to be able to see error messages

:e term://typst watch %

  • silently open the pdf in mupdf

:!mupdf %<.pdf > /dev/null 2>&1 & disown

  • silently refresh mupdf whenever the pdf file changes

:!while inotifywait -qq -e modify %<.pdf; do pkill -HUP mupdf; done & disown

  • silently autowrite .typ file in current buffer whenever it changes

:autocmd TextChanged,TextChangedI <buffer> silent write

  • to turn the silent autowrite off use :autocmd! TextChanged,TextChangedI <buffer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment