From e7a4d52f058b478736566629a8556bccd716b70e Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Sun, 12 May 2024 20:58:08 +0545 Subject: [PATCH 1/3] Create undotree.lua --- .../plugins/extras/editor/undotree.lua | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/editor/undotree.lua diff --git a/lua/lazyvim/plugins/extras/editor/undotree.lua b/lua/lazyvim/plugins/extras/editor/undotree.lua new file mode 100644 index 00000000..cef1ecb2 --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/undotree.lua @@ -0,0 +1,26 @@ +return { + { + "mbbill/undotree", + cmd = "UndotreeToggle", + keys = { + -- [U]ndo [T]ree + { "uT", "UndotreeToggle", 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, + }, +} From 0481c8fe10edc587bd7c8520cccc975e49a9a675 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Fri, 31 May 2024 13:50:54 +0545 Subject: [PATCH 2/3] fix: remap undotree key to uu --- lua/lazyvim/plugins/extras/editor/undotree.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/undotree.lua b/lua/lazyvim/plugins/extras/editor/undotree.lua index cef1ecb2..1994a26f 100644 --- a/lua/lazyvim/plugins/extras/editor/undotree.lua +++ b/lua/lazyvim/plugins/extras/editor/undotree.lua @@ -3,8 +3,7 @@ return { "mbbill/undotree", cmd = "UndotreeToggle", keys = { - -- [U]ndo [T]ree - { "uT", "UndotreeToggle", desc = "Undo Tree Toggle" }, + { "uu", "UndotreeToggle", desc = "Undo Tree Toggle" }, }, init = function() -- Persist undo, refer https://github.com/mbbill/undotree#usage From 0ae6fd4de9accfe21ff0eac2abc8e67f5958d673 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Fri, 31 May 2024 20:05:15 +0545 Subject: [PATCH 3/3] Update undotree.lua --- lua/lazyvim/plugins/extras/editor/undotree.lua | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/undotree.lua b/lua/lazyvim/plugins/extras/editor/undotree.lua index 1994a26f..b220f16e 100644 --- a/lua/lazyvim/plugins/extras/editor/undotree.lua +++ b/lua/lazyvim/plugins/extras/editor/undotree.lua @@ -6,18 +6,6 @@ return { { "uu", "UndotreeToggle", 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,