mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(picker.undo): disable swap for tmp undo buffer
This commit is contained in:
parent
3d4b8eeea9
commit
033db250cd
1 changed files with 2 additions and 1 deletions
|
@ -346,13 +346,14 @@ function M.undo(opts, ctx)
|
|||
local tmp_file = vim.fn.stdpath("cache") .. "/snacks-undo"
|
||||
local tmp_undo = tmp_file .. ".undo"
|
||||
local tmpbuf = vim.fn.bufadd(tmp_file)
|
||||
vim.bo[tmpbuf].swapfile = false
|
||||
vim.fn.writefile(vim.api.nvim_buf_get_lines(buf, 0, -1, false), tmp_file)
|
||||
vim.fn.bufload(tmpbuf)
|
||||
vim.api.nvim_buf_call(buf, function()
|
||||
vim.cmd("silent wundo! " .. tmp_undo)
|
||||
end)
|
||||
vim.api.nvim_buf_call(tmpbuf, function()
|
||||
vim.cmd("silent rundo " .. tmp_undo)
|
||||
pcall(vim.cmd, "silent rundo " .. tmp_undo)
|
||||
end)
|
||||
|
||||
---@param item snacks.picker.finder.Item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue