diff --git a/lua/configs/undotree.lua b/lua/configs/undotree.lua new file mode 100644 index 0000000..4f54965 --- /dev/null +++ b/lua/configs/undotree.lua @@ -0,0 +1,20 @@ +vim.cmd [[ +let g:undotree_WindowLayout=2 +let g:undotree_DiffpanelHeight=8 +" let g:undotree_DiffCommand = "delta" + +if has("persistent_undo") + let target_path = expand('~/.undodir') + + " create the directory and any parent directories + " if the location does not exist. + if !isdirectory(target_path) + call mkdir(target_path, "p", 0700) + endif + + let &undodir=target_path + set undofile +endif +]] + +vim.keymap.set('n', 'tu', vim.cmd.UndotreeToggle, {}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 7815724..86e55c8 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,4 +1,12 @@ return { + { + "mbbill/undotree", + lazy = false, + config = function() + require "configs.undotree" + end, + }, + { "stevearc/conform.nvim", -- event = 'BufWritePre', -- uncomment for format on save