Configs2026年7月28日·1 分钟阅读

nvim-tree.lua — File Explorer Tree for Neovim

File tree explorer sidebar with git integration, filtering, and icons for Neovim.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
nvim-tree.lua Overview
直接安装命令
npx -y tokrepo@latest install 339e672d-8a1c-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产