* fix(#1989): cut/paste overwrite deletes destination buffer * fix(#1989): cut/paste overwrite deletes destination buffer
This commit is contained in:
parent
d17389ce53
commit
4af572246c
@ -161,6 +161,17 @@ function M.get_nodes_by_line(nodes_all, line_start)
|
||||
end
|
||||
|
||||
function M.rename_loaded_buffers(old_path, new_path)
|
||||
-- delete new if it exists
|
||||
for _, buf in pairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_loaded(buf) then
|
||||
local buf_name = vim.api.nvim_buf_get_name(buf)
|
||||
if buf_name == new_path then
|
||||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- rename old to new
|
||||
for _, buf in pairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_loaded(buf) then
|
||||
local buf_name = vim.api.nvim_buf_get_name(buf)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user