From 5140754851bdb2ecf67d215b66bcc1e272791fea Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Wed, 31 Aug 2022 15:24:40 -0500 Subject: feat(nvim): add config for undotree --- nvim/.config/nvim/lua/tobyvin/plugins.lua | 3 +-- nvim/.config/nvim/lua/tobyvin/plugins/undotree.lua | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 nvim/.config/nvim/lua/tobyvin/plugins/undotree.lua (limited to 'nvim') diff --git a/nvim/.config/nvim/lua/tobyvin/plugins.lua b/nvim/.config/nvim/lua/tobyvin/plugins.lua index 892ee5e..9119064 100644 --- a/nvim/.config/nvim/lua/tobyvin/plugins.lua +++ b/nvim/.config/nvim/lua/tobyvin/plugins.lua @@ -381,9 +381,8 @@ M.plugins = function(use) use({ "mbbill/undotree", - cmd = "UndotreeToggle", config = function() - vim.g.undotree_SetFocusWhenToggle = 1 + require("tobyvin.plugins.undotree").setup() end, }) diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/undotree.lua b/nvim/.config/nvim/lua/tobyvin/plugins/undotree.lua new file mode 100644 index 0000000..976a053 --- /dev/null +++ b/nvim/.config/nvim/lua/tobyvin/plugins/undotree.lua @@ -0,0 +1,13 @@ +local M = {} + +M.setup = function() + local status_ok, undotree = pcall(require, "undotree") + if not status_ok then + vim.notify("Failed to load module 'undotree'", "error") + return + end + + vim.keymap.set("n", "u", undotree.toggle, { desc = "Toggle undotree" }) +end + +return M -- cgit v1.2.3-70-g09d2