mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +01:00
feat: switch to already open buffer instead of err
This commit is contained in:
parent
661985c62b
commit
a98c216a8f
1 changed files with 5 additions and 1 deletions
|
@ -44,8 +44,12 @@ M.open = function(state, path, extra)
|
||||||
end
|
end
|
||||||
if selected.type == "buffer" then
|
if selected.type == "buffer" then
|
||||||
local window = utils.get_appropriate_window(state)
|
local window = utils.get_appropriate_window(state)
|
||||||
local buf = vim.api.nvim_create_buf(true, false)
|
|
||||||
vim.api.nvim_set_current_win(window)
|
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)
|
vim.api.nvim_win_set_buf(window, buf)
|
||||||
buf_manager.attach(selected.name, buf)
|
buf_manager.attach(selected.name, buf)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue