-- disable netrw at the very start of your init.lua (strongly advised) vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 -- set termguicolors to enable highlight groups vim.opt.termguicolors = true -- OR setup with some options require("nvim-tree").setup({ auto_reload_on_write = true, sort_by = "case_sensitive", sync_root_with_cwd = true, respect_buf_cwd = true, update_focused_file = { enable = true, update_root = true, }, filters = { custom = {}, dotfiles = true, exclude = { ".golangci*", ".protolint*", ".gitignore" }, }, filesystem_watchers = { enable = true, debounce_delay = 10, }, git = { enable = true, ignore = true, show_on_dirs = true, show_on_open_dirs = true, timeout = 400, }, modified = { enable = false, show_on_dirs = true, show_on_open_dirs = true, }, view = { width = 40, mappings = { list = { { key = "u", action = "dir_up" }, }, }, }, renderer = { full_name = true, group_empty = true, indent_markers = { enable = true, }, icons = { git_placement = "signcolumn", show = { file = true, folder = true, folder_arrow = true, git = true, }, }, }, diagnostics = { enable = true, show_on_dirs = true, }, actions = { change_dir = { enable = false, restrict_above_cwd = true, }, open_file = { resize_window = true, window_picker = { chars = "aoeui", }, }, remove_file = { close_window = false, }, }, log = { enable = false, truncate = true, types = { all = false, config = false, copy_paste = false, diagnostics = false, git = false, profile = false, watcher = false, }, }, }) local function open_nvim_tree(data) -- buffer is a directory local directory = vim.fn.isdirectory(data.file) == 1 if not directory then return end -- change to the directory vim.cmd.cd(data.file) -- open the tree require("nvim-tree.api").tree.open() end vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })