diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua index 9c5170c..1347101 100644 --- a/lua/user/nvim-tree.lua +++ b/lua/user/nvim-tree.lua @@ -31,7 +31,16 @@ if not config_status_ok then return end +-- Replaces auto_close local tree_cb = nvim_tree_config.nvim_tree_callback +vim.api.nvim_create_autocmd("BufEnter", { + nested = true, + callback = function() + if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then + vim.cmd "quit" + end + end +}) nvim_tree.setup { disable_netrw = true, @@ -42,14 +51,9 @@ nvim_tree.setup { "dashboard", "alpha", }, - auto_close = true, open_on_tab = false, hijack_cursor = false, update_cwd = true, - update_to_buf_dir = { - enable = true, - auto_open = true, - }, diagnostics = { enable = true, icons = { @@ -82,7 +86,6 @@ nvim_tree.setup { height = 30, hide_root_folder = false, side = "left", - auto_resize = true, mappings = { custom_only = false, list = { @@ -98,15 +101,23 @@ nvim_tree.setup { cmd = "trash", require_confirm = true, }, - quit_on_open = 0, - git_hl = 1, - disable_window_picker = 0, - root_folder_modifier = ":t", - show_icons = { - git = 1, - folders = 1, - files = 1, - folder_arrows = 1, - tree_width = 30, + actions = { + open_file = { + quit_on_open = true, + window_picker = { + enable = false, + }, + }, }, + +-- unknown options as of 22.05 +-- +-- update_to_buf_dir = { +-- enable = true, +-- auto_open = true, +-- }, +-- auto_resize = true, +-- git_hl = 1, +-- root_folder_modifier = ":t", + }