fix(commands): register VimLeavePre to call stop_all

Problem: spawned compiler processes and watching autocmds were never
cleaned up when Neovim exited, leaving orphaned processes running.

Solution: register a VimLeavePre autocmd in commands setup that calls
compiler.stop_all(), which kills active processes, unwatches all
buffers, and stops the reload server.
This commit is contained in:
Barrett Ruth 2026-03-04 13:48:46 -05:00
parent 75b855438a
commit 9d4f2e77cc
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 19 additions and 0 deletions

View file

@ -57,6 +57,12 @@ function M.setup()
end,
desc = 'Toggle, compile, clean, open, or check status of document preview',
})
vim.api.nvim_create_autocmd('VimLeavePre', {
callback = function()
require('preview.compiler').stop_all()
end,
})
end
return M