From d641466c5e23b3e31f5ee4ae839eb461579f5c71 Mon Sep 17 00:00:00 2001 From: gogongxt Date: Thu, 12 Mar 2026 11:51:12 +0800 Subject: [PATCH] fix: open file with swap error --- lua/flatten/core.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/flatten/core.lua b/lua/flatten/core.lua index e7388d3..8dac22e 100644 --- a/lua/flatten/core.lua +++ b/lua/flatten/core.lua @@ -184,9 +184,14 @@ function M.edit_files(opts) fpath = guest_cwd .. "/" .. fname end + local bufnr = vim.fn.bufadd(fpath) + -- Disable swapfile before loading to avoid interactive prompts + vim.api.nvim_set_option_value("swapfile", false, { buf = bufnr }) + vim.fn.bufload(bufnr) + local file = { fname = fpath, - bufnr = vim.fn.bufadd(fpath), + bufnr = bufnr, } vim.api.nvim_set_option_value("buflisted", true, {