feat: most moves and copies will copy the undofile (#583)
This commit is contained in:
parent
5313690956
commit
32dd3e378d
4 changed files with 51 additions and 6 deletions
|
|
@ -195,6 +195,18 @@ M.rename_buffer = function(src_bufnr, dest_buf_name)
|
|||
-- Try to delete, but don't if the buffer has changes
|
||||
pcall(vim.api.nvim_buf_delete, src_bufnr, {})
|
||||
end
|
||||
-- Renaming a buffer won't load the undo file, so we need to do that manually
|
||||
if vim.bo[dest_bufnr].undofile then
|
||||
vim.api.nvim_buf_call(dest_bufnr, function()
|
||||
vim.cmd.rundo({
|
||||
args = { vim.fn.undofile(dest_buf_name) },
|
||||
magic = { file = false, bar = false },
|
||||
mods = {
|
||||
emsg_silent = true,
|
||||
},
|
||||
})
|
||||
end)
|
||||
end
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue