Skip to content

IV. Configuring File Explorer

kate edited this page Jun 1, 2024 · 4 revisions

prev | next

File Explorer (or nvim-tree) is a neat plugin. Install it by adding this to your init.vim:

" File Explorer
Plug 'nvim-tree/nvim-web-devicons' " optional, for file icons
Plug 'nvim-tree/nvim-tree.lua'

Now, add the following to your init.lua (or branch it off into something like tree.lua):

require("nvim-tree").setup({
  sort = {
    sorter = "case_sensitive",
  },
  view = {
    width = 20,
  },
  renderer = {
    group_empty = true,
  },
  filters = {
    dotfiles = true,
  },
})

Optionally, you can open nvim-tree whenever you open a file with Neovim too, like this:

vim.api.nvim_create_autocmd("BufReadPost", {
  callback = function(data)
    local api = require("nvim-tree.api")
    api.tree.open()
  end,
})
Clone this wiki locally