Don't Open NvimTree On Neovim Startup

July 2025

Comment out the line:

vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

In the file:

~/.config/nvim/after/plugin/nvim-tree-config.lua

Details

I've got the following in my nvim-tree-config.lua file to automatically open NvimTree on startup:

local function open_nvim_tree()
  require("nvim-tree.api").tree.open()
  vim.cmd.wincmd 'p'
end

vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

Commenting out the last line removes the autocmd that is responsibe for opening it on startup.

end of line