mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Create undotree.lua
This commit is contained in:
parent
42010d1dfb
commit
e7a4d52f05
1 changed files with 26 additions and 0 deletions
26
lua/lazyvim/plugins/extras/editor/undotree.lua
Normal file
26
lua/lazyvim/plugins/extras/editor/undotree.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"mbbill/undotree",
|
||||||
|
cmd = "UndotreeToggle",
|
||||||
|
keys = {
|
||||||
|
-- [U]ndo [T]ree
|
||||||
|
{ "<leader>uT", "<cmd>UndotreeToggle<cr>", desc = "Undo Tree Toggle" },
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- Persist undo, refer https://github.com/mbbill/undotree#usage
|
||||||
|
local undodir = vim.fn.expand("~/.undo-nvim")
|
||||||
|
|
||||||
|
if vim.fn.has("persistent_undo") == 1 then
|
||||||
|
if vim.fn.isdirectory(undodir) == 0 then
|
||||||
|
os.execute("mkdir -p " .. undodir)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.undodir = undodir
|
||||||
|
vim.opt.undofile = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- set layout style to 2, let g:undotree_WindowLayout = 2
|
||||||
|
vim.g.undotree_WindowLayout = 2
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue