fix(dir): preserve alternate buffer #40659

This commit is contained in:
Barrett Ruth
2026-07-09 14:41:09 -05:00
committed by GitHub
parent 8c285c6c33
commit a54a7f6a78
2 changed files with 21 additions and 1 deletions

View File

@@ -85,7 +85,14 @@ local function render(buf, dir)
then
return false
end
api.nvim_buf_set_name(buf, dir)
api.nvim_buf_call(buf, function()
api.nvim_cmd({
cmd = 'file',
args = { dir },
mods = { keepalt = true },
magic = { file = false, bar = false },
}, {})
end)
if not api.nvim_buf_is_valid(buf) then
return false
end