From 199ccf030c6cc374c586102f250fe42f7bb83255 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 15 Mar 2026 13:34:44 -0400 Subject: [PATCH] feat(compiler): fire `PreviewWatchingStopped` user event Problem: there was no way for user config to react when preview watching stops, e.g. to clean up forward-search state for SyncTeX. Solution: fire a `PreviewWatchingStopped` user autocmd from `stop_watching` with `bufnr` and `provider` in the event data. --- lua/preview/compiler.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/preview/compiler.lua b/lua/preview/compiler.lua index 85a72c1..cc36873 100644 --- a/lua/preview/compiler.lua +++ b/lua/preview/compiler.lua @@ -196,6 +196,10 @@ local function stop_watching(bufnr, s) s.debounce:close() s.debounce = nil end + vim.api.nvim_exec_autocmds('User', { + pattern = 'PreviewWatchingStopped', + data = { bufnr = bufnr, provider = s.provider }, + }) end ---@param bufnr integer