Introduction
nvim-tree.lua is a file explorer plugin for Neovim that renders a tree-view sidebar for navigating your project's directory structure. It is written in Lua and designed as a lightweight, fast alternative to heavier file managers. The repository is nvim-tree/nvim-tree.lua on GitHub with approximately 8,608 stars.
What nvim-tree.lua Does
The plugin displays a collapsible directory tree in a sidebar window. Users can browse, open, rename, delete, copy, and move files and directories directly from the tree. It shows git status indicators next to files and folders, supports file filtering by name or extension, and renders file-type icons via nvim-web-devicons.
Architecture Overview
nvim-tree.lua uses a single sidebar buffer that renders the tree from an in-memory directory model. The renderer converts the directory state into decorated lines with icons, git markers, and indentation. File system watchers detect external changes and refresh the tree. Actions like create, rename, and delete operate through Neovim's built-in filesystem APIs. The git integration reads repository status and maps changes to tree nodes.
Self-Hosting & Configuration
nvim-tree.lua runs entirely within Neovim. Install the plugin and optional nvim-web-devicons for file icons. Configuration is done through require("nvim-tree").setup({}) with options for view width, side placement, filtering rules, sort order, git integration, and renderer customization. The plugin recommends disabling netrw to avoid conflicts.
Key Features
- Tree-view sidebar with expandable directories
- Git status indicators (modified, staged, untracked, ignored)
- File operations: create, rename, delete, copy, move, paste
- File-type icons via nvim-web-devicons
- Filtering by dotfiles, custom patterns, or gitignore rules
- Live file system watching for external changes
- Diagnostics integration showing LSP errors in the tree
- Bookmarks and custom marks for quick navigation
Comparison with Similar Tools
Compared to neo-tree.nvim, nvim-tree.lua focuses on being a dedicated file tree with lower complexity, while neo-tree supports buffer and git-status panels. oil.nvim takes a different approach by editing directories as buffers rather than showing a tree sidebar. Neovim's built-in netrw provides basic file browsing but lacks git integration, icons, and the polished tree UI that nvim-tree.lua offers. Telescope's file browser is modal and search-driven, whereas nvim-tree.lua provides a persistent sidebar.
FAQ
Q: Should I disable netrw when using nvim-tree?
A: Yes, the plugin recommends setting vim.g.loaded_netrw = 1 and vim.g.loaded_netrwPlugin = 1 before setup to prevent conflicts.
Q: Can I use nvim-tree without icons? A: Yes. nvim-web-devicons is optional. Without it, the tree renders without file-type icons but remains fully functional.
Q: Does nvim-tree support floating windows?
A: Yes. Set view.float.enable = true in the setup configuration to render the tree in a floating window instead of a sidebar.
Sources
- GitHub repository: https://github.com/nvim-tree/nvim-tree.lua
- Documentation: https://github.com/nvim-tree/nvim-tree.lua/blob/master/doc/nvim-tree-lua.txt