feat: rename watch → toggle, auto-compile on start, built-in opener
Problem: :Preview watch only registered a BufWritePost autocmd without
compiling immediately, required boilerplate to open output files after
first compilation, and was misleadingly named.
Solution: Rename watch → toggle throughout. M.toggle now compiles
immediately on activation. Add an open field to ProviderConfig: true
calls vim.ui.open(), a string[] runs the command with the output path
appended, tracked per-buffer so the file opens only once. All presets
default to { 'xdg-open' }. Health check validates opener binaries.
Guard the async compile callback against invalid buffer ids.
This commit is contained in:
parent
c62c930454
commit
673573044f
12 changed files with 346 additions and 176 deletions
|
|
@ -20,8 +20,11 @@ function M.delete_buffer(bufnr)
|
|||
end
|
||||
|
||||
function M.reset_config(opts)
|
||||
vim.g.preview = opts
|
||||
require('preview')._test.reset()
|
||||
local preview = require('preview')
|
||||
preview._test.reset()
|
||||
if opts then
|
||||
preview.setup(opts)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue