Overview
NvimTree is a file explorer plugin that provides a tree-style view of your project’s file structure. It replaces Neovim’s built-in netrw with a more feature-rich and performant alternative. Plugin: nvim-tree/nvim-tree.luaFeatures
- Tree-style file explorer with icons
- Relative line numbers for quick navigation
- Git status integration
- Indent markers for better visibility
- Custom folder arrow icons
- File operations (create, delete, rename, copy)
- Integration with window splits
Configuration
NvimTree is configured inlua/magictt/plugins/nvim-tree.lua:
Keybindings
Global Keymaps
| Keymap | Command | Description |
|---|---|---|
<leader>ee | :NvimTreeToggle | Toggle file explorer |
<leader>ef | :NvimTreeFindFileToggle | Toggle explorer on current file |
<leader>ec | :NvimTreeCollapse | Collapse all folders |
<leader>er | :NvimTreeRefresh | Refresh file explorer |
Inside NvimTree Window
When the NvimTree window is focused, you can use these default keybindings:Navigation
| Key | Action |
|---|---|
j/k | Move down/up |
<CR> | Open file or expand/collapse folder |
o | Open file or folder |
P | Go to parent directory |
<BS> | Close directory |
- | Navigate to parent directory |
File Operations
| Key | Action |
|---|---|
a | Create new file or directory (end with /) |
d | Delete file or directory |
r | Rename file or directory |
x | Cut file or directory |
c | Copy file or directory |
p | Paste file or directory |
y | Copy file name |
Y | Copy relative path |
gy | Copy absolute path |
View Options
| Key | Action |
|---|---|
H | Toggle hidden files |
I | Toggle gitignore files |
R | Refresh tree |
W | Collapse all folders |
E | Expand all folders |
g? | Show help (all keybindings) |
Window Management
| Key | Action |
|---|---|
<C-v> | Open file in vertical split |
<C-x> | Open file in horizontal split |
<C-t> | Open file in new tab |
q | Close NvimTree window |
Usage Examples
Toggle File Explorer
Press<leader>ee to open/close the file explorer:
Find Current File
Press<leader>ef to open the explorer and highlight the current file:
Collapse All Folders
Press<leader>ec to collapse all expanded folders:
Refresh Tree
Press<leader>er to refresh the file tree (useful after external changes):
Tips and Tricks
Creating Files and Directories
Pressa in NvimTree to create:
- File: Type filename and press Enter:
newfile.lua - Directory: Type name ending with
/:newfolder/ - Nested structure: Type full path:
src/components/Button.tsx
Git Integration
NvimTree shows git status with icons:✓- Staged changes✗- Unstaged changes★- Untracked files➜- Renamed files
git.ignore = false).
Relative Line Numbers
The explorer uses relative line numbers (configured withrelativenumber = true), making it easy to jump to files using motions like 10j or 5k.
Working with Splits
The configuration disables window picker for better split behavior:- Files open in the last active window
- Use
<C-v>for vertical split - Use
<C-x>for horizontal split
Copy File Paths
Quickly copy file paths:y- Copy just the filenameY- Copy relative path from project rootgy- Copy absolute path
Filtering Files
The config filters out.DS_Store files automatically. Show/hide other files:
H- Toggle hidden files (files starting with.)I- Toggle gitignored files
Customization Tips
Change Tree Width
Modify thewidth setting in nvim-tree.lua:
Different Folder Icons
Customize the folder arrows:Filter Additional Files
Add more files to filter:Auto-close on File Open
To close NvimTree when opening a file:Integration with Alpha Dashboard
NvimTree is integrated into the Alpha dashboard:- Press
Space eefrom the dashboard to open the file explorer - The dashboard button uses the same command as the global keymap
Related Plugins
Troubleshooting
No file icons showing- Install a Nerd Font and configure your terminal to use it
- Check nvim-web-devicons is loaded:
:Lazy
- Check for errors:
:messages - Verify netrw is disabled:
:echo g:loaded_netrw
- Ensure you’re in a git repository
- Check git is installed:
git --version - Verify git integration is enabled in config
- Check your Neovim version (requires 0.7+)
- Verify the config has
relativenumber = true