From 454030ad78642083e0cc372b49153af4c763c506 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Wed, 4 Mar 2026 14:51:14 -0500 Subject: [PATCH] fix(compiler): do not auto-open on one-shot compile Problem: auto-open fired on :Preview compile, which is a one-shot build. Users compiling to check for errors or rebuild with the viewer already open got an unexpected browser/viewer window. Solution: gate auto-open on not opts.oneshot so it only fires during toggle/watch mode, where opening the viewer on first compile is the intended behaviour. --- lua/preview/compiler.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/preview/compiler.lua b/lua/preview/compiler.lua index 74d6070..38a048e 100644 --- a/lua/preview/compiler.lua +++ b/lua/preview/compiler.lua @@ -162,6 +162,7 @@ function M.compile(bufnr, name, provider, ctx, opts) if provider.open + and not opts.oneshot and not opened[bufnr] and output_file ~= '' and vim.uv.fs_stat(output_file) @@ -240,6 +241,7 @@ function M.compile(bufnr, name, provider, ctx, opts) end if provider.open + and not opts.oneshot and not opened[bufnr] and output_file ~= '' and vim.uv.fs_stat(output_file)