require('nvim-tree').setup({ open_on_tab = false, filters = { dotfiles = true, }, actions = { open_file = { quit_on_open = true, }, }, }) showHiddenFiles = false local function open_nvim_tree(data) -- buffer is a directory local directory = vim.fn.isdirectory(data.file) == 1 local empty_file = data.file == "" if not directory and not empty_file then return end if directory then vim.cmd.cd(data.file) end vim.cmd.enew() vim.cmd.bw(data.buf) -- change to directory and open require("nvim-tree.api").tree.open() end -- toggle dotfiles visibility vim.keymap.set("n", "d", ":lua require('nvim-tree.api').tree.toggle_hidden_filter()") -- nvim-tree open at startup vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree, })