diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index 1fc97af..7fdb8bf 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -1,12 +1,22 @@ return { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - config = function() - vim.keymap.set('n', '', ':Neotree filesystem reveal right toggle', {}) - end - } + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + require("neo-tree").setup({ + event_handlers = { + { + event = "file_opened", + handler = function(file_path) + require("neo-tree.command").execute({ action = "close" }) + end, + }, + }, + }) + vim.keymap.set("n", "", ":Neotree filesystem reveal right", {}) -- toggle + end, +}