preview.nvim/lua
Barrett Ruth a2edb9a499
fix(compiler): use BufDelete instead of BufUnload for cleanup
Problem: `:e` (edit/reload) fires `BufUnload`, which tears down the
entire preview — process, watchers, and viewer — even though the user
is just reloading the current buffer.

Solution: Switch the cleanup autocmd from `BufUnload` to `BufDelete`,
which only fires on `:bdelete` and `:bwipeout`. Guard `nvim_del_autocmd`
calls with `pcall` in cleanup paths since buffer-local autocmds may
already be gone when the buffer is wiped before `stop_watching` runs.

Closes #57
2026-03-12 16:47:36 -04:00
..
preview fix(compiler): use BufDelete instead of BufUnload for cleanup 2026-03-12 16:47:36 -04:00