feat: switch to already open buffer instead of err

This commit is contained in:
əlemi 2024-09-06 20:01:15 +02:00
parent 661985c62b
commit a98c216a8f
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -44,8 +44,12 @@ M.open = function(state, path, extra)
end
if selected.type == "buffer" then
local window = utils.get_appropriate_window(state)
local buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_set_current_win(window)
if buf_manager.map_rev[selected.name] ~= nil then
vim.api.nvim_win_set_buf(window, buf_manager.map_rev[selected.name])
return
end
local buf = vim.api.nvim_create_buf(true, false)
vim.api.nvim_win_set_buf(window, buf)
buf_manager.attach(selected.name, buf)
return