From 85dfdeacf730bd324d421839a7bd528fce796d61 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 15 Mar 2026 13:36:23 -0400 Subject: [PATCH] docs: document `PreviewWatchingStopped` event and update SyncTeX recipes Problem: the new `PreviewWatchingStopped` event was undocumented, and the SyncTeX recipes never cleared `synctex_pdf` on watch stop. Solution: add the event to the events section and update the shared SyncTeX setup block to clear `synctex_pdf[bufnr]` on stop. --- doc/preview.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/preview.txt b/doc/preview.txt index be1d82b..d5ae5bd 100644 --- a/doc/preview.txt +++ b/doc/preview.txt @@ -293,6 +293,9 @@ preview.nvim fires User autocmds with structured data: `PreviewCompileFailed` Compilation failed (non-zero exit). data: `{ bufnr, provider, code, stderr }` +`PreviewWatchingStopped` Watching stopped (toggle off or buffer delete). + data: `{ bufnr, provider }` + Example: >lua vim.api.nvim_create_autocmd('User', { pattern = 'PreviewCompileSuccess', @@ -354,6 +357,12 @@ The following configs leverage the below basic setup: ~ synctex_pdf[args.data.bufnr] = args.data.output end, }) + vim.api.nvim_create_autocmd('User', { + pattern = 'PreviewWatchingStopped', + callback = function(args) + synctex_pdf[args.data.bufnr] = nil + end, + }) < The recipes below bind `s` for forward search. To scroll the PDF