nvim-tree.lua

GitHub

A file explorer tree for neovim written in lua

AI Prompts & Endpoints
Agent Skills View CodeWiki Knowledge Base

Doc/Nvim Tree Lua

nvim-tree-lua.txt A File Explorer For Nvim nvim_tree nvim-tree

Author: Yazdani Kiyan
Type |gO| to see the table of contents.
Help tag prefixes:
nvim-tree- Help Sections e.g.
• |nvim-tree-mappings|
• |nvim-tree-config|
nvim_tree. API and classes e.g.
• |nvim_tree.api.node.navigate.parent()|
• |nvim_tree.config.filesystem_watchers|

==============================================================================
Introduction nvim-tree-introduction

Features

- Automatic updates
- File type icons
- Git integration
- Diagnostics integration: LSP and COC
- (Live) filtering
- Rename, delete, create
- Cut, copy, paste locally and between instances
- Highly customisable

File Icons

https://github.com/nvim-tree/nvim-web-devicons is optional and used to display file icons.
It requires a patched font: https://www.nerdfonts.com
Your terminal emulator must be configured to use that font, usually "Hack Nerd Font"

 should look like an open folder.

Disable the display of icons with |nvim_tree.config.renderer.icons.show|

Colours

Syntax highlighting uses g:terminal_color_ from colorschemes, falls back to
ugly colors otherwise.

Git Integration

One or two icons for git status. When two are shown, the left is staged.

✗ unstaged
✓ staged
 unmerged
➜ renamed
★ untracked
 deleted
◌ ignored

Requirements

Nvim >= 0.10.
At least n - 0.1 stable Nvim compatibility is guaranteed.
You may use a compat-nvim-0.X tag for earlier Nvim versions, however
they will receive no updates or support.

==============================================================================
Quickstart nvim-tree-quickstart

Install the plugins via your package manager:
"nvim-tree/nvim-tree.lua"
"nvim-tree/nvim-web-devicons"

Disabling |netrw| is strongly advised, see |nvim-tree-netrw|

==============================================================================
Quickstart: Setup nvim-tree-quickstart-setup

Setup the plugin in your init.lua.

See |nvim-tree-setup| and |nvim-tree-config-default| >lua

-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

-- optionally enable 24-bit colour
vim.opt.termguicolors = true

-- empty setup using defaults
require("nvim-tree").setup()

-- OR setup with a config

---@type nvim_tree.config
local config = {
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
}
require("nvim-tree").setup(config)
<
==============================================================================
Quickstart: Help nvim-tree-quickstart-help

Open the tree: :NvimTreeOpen

Show the mappings: g?

<C-]> n CD |nvim_tree.api.tree.change_root_to_node()|
<C-e> n Open: In Place |nvim_tree.api.node.open.replace_tree_buffer()|
<C-k> n Info |nvim_tree.api.node.show_info_popup()|
<C-r> n Rename: Omit Filename |nvim_tree.api.fs.rename_sub()|
<C-t> n Open: New Tab |nvim_tree.api.node.open.tab()|
<C-v> n Open: Vertical Split |nvim_tree.api.node.open.vertical()|
<C-x> n Open: Horizontal Split |nvim_tree.api.node.open.horizontal()|
<BS> n Close Directory |nvim_tree.api.node.navigate.parent_close()|
<CR> n Open |nvim_tree.api.node.open.edit()|
<Del> nx Delete |nvim_tree.api.fs.remove()|
<Tab> n Open Preview |nvim_tree.api.node.open.preview()|
> n Next Sibling |nvim_tree.api.node.navigate.sibling.next()|
< n Previous Sibling |nvim_tree.api.node.navigate.sibling.prev()|
. n Run Command |nvim_tree.api.node.run.cmd()|
- n Up |nvim_tree.api.tree.change_root_to_parent()|
a n Create File Or Directory |nvim_tree.api.fs.create()|
bd n Delete Bookmarked |nvim_tree.api.marks.bulk.delete()|
bt n Trash Bookmarked |nvim_tree.api.marks.bulk.trash()|
bmv n Move Bookmarked |nvim_tree.api.marks.bulk.move()|
B n Toggle Filter: No Buffer |nvim_tree.api.filter.no_buffer.toggle()|
c nx Copy |nvim_tree.api.fs.copy.node()|
C n Toggle Filter: Git Clean |nvim_tree.api.filter.git.clean.toggle()|
[c n Prev Git |nvim_tree.api.node.navigate.git.prev()|
]c n Next Git |nvim_tree.api.node.navigate.git.next()|
d nx Delete |nvim_tree.api.fs.remove()|
D nx Trash |nvim_tree.api.fs.trash()|
E n Expand All |nvim_tree.api.tree.expand_all()|
e n Rename: Basename |nvim_tree.api.fs.rename_basename()|
]e n Next Diagnostic |nvim_tree.api.node.navigate.diagnostics.next()|
[e n Prev Diagnostic |nvim_tree.api.node.navigate.diagnostics.prev()|
F n Live Filter: Clear |nvim_tree.api.filter.live.clear()|
f n Live Filter: Start |nvim_tree.api.filter.live.start()|
g? n Help |nvim_tree.api.tree.toggle_help()|
gy nx Copy Absolute Path |nvim_tree.api.fs.copy.absolute_path()|
ge n Copy Basename |nvim_tree.api.fs.copy.basename()|
H n Toggle Filter: Dotfiles |nvim_tree.api.filter.dotfiles.toggle()|
I n Toggle Filter: Git Ignored |nvim_tree.api.filter.git.ignored.toggle()|
J n Last Sibling |nvim_tree.api.node.navigate.sibling.last()|
K n First Sibling |nvim_tree.api.node.navigate.sibling.first()|
L n Toggle Group Empty |nvim_tree.api.node.open.toggle_group_empty()|
M n Toggle Filter: No Bookmark |nvim_tree.api.filter.no_bookmark.toggle()|
m nx Toggle Bookmark |nvim_tree.api.marks.toggle()|
o n Open |nvim_tree.api.node.open.edit()|
O n Open: No Window Picker |nvim_tree.api.node.open.no_window_picker()|
p n Paste |nvim_tree.api.fs.paste()|
gp n Move |nvim_tree.api.fs.move()|
P n Parent Directory |nvim_tree.api.node.navigate.parent()|
q n Close |nvim_tree.api.tree.close()|
r n Rename |nvim_tree.api.fs.rename()|
R n Refresh |nvim_tree.api.tree.reload()|
s n Run System |nvim_tree.api.node.run.system()|
S n Search |nvim_tree.api.tree.search_node()|
u n Rename: Full Path |nvim_tree.api.fs.rename_full()|
U n Toggle Filter: Custom |nvim_tree.api.filter.custom.toggle()|
W n Collapse All |nvim_tree.api.tree.collapse_all()|
x nx Cut |nvim_tree.api.fs.cut()|
y n Copy Name |nvim_tree.api.fs.copy.filename()|
Y n Copy Relative Path |nvim_tree.api.fs.copy.relative_path()|
<2-LeftMouse> n Open |nvim_tree.api.node.open.edit()|
<2-RightMouse> n CD |nvim_tree.api.tree.change_root_to_node()|

==============================================================================
Quickstart: Custom Mappings nvim-tree-quickstart-custom-mappings

|nvim-tree-mappings-default| are applied by default however you may customise
via |nvim_tree.config| {on_attach} e.g. >lua

local function my_on_attach(bufnr)
local api = require "nvim-tree.api"

local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end

-- default mappings
api.map.on_attach.default(bufnr)

-- custom mappings
vim.keymap.set("n", "<C-t>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
end

-- pass to setup along with your other config
require("nvim-tree").setup({
---
on_attach = my_on_attach,
---
})
<
==============================================================================
Quickstart: Highlight Groups nvim-tree-quickstart-highlight

Run |:NvimTreeHiTest| to show all the highlights that nvim-tree uses.

They can be customised before or after setup is called and will be immediately
applied at runtime. e.g. >lua

vim.cmd([[
:hi NvimTreeExecFile guifg=#ffa0a0
:hi NvimTreeSpecialFile guifg=#ff80ff gui=underline
:hi NvimTreeSymlink guifg=Yellow gui=italic
:hi link NvimTreeImageFile Title
]])
<
See |nvim-tree-highlight-groups| for details.

==============================================================================
Commands nvim-tree-commands

Some commands may be executed with a |<bang>| ! or take a path string argument.

All commands execute public API.

:NvimTreeOpen |nvim_tree.api.tree.open()| >lua

require("nvim-tree.api").tree.open({
path = "<args>"
})
<
:NvimTreeClose |nvim_tree.api.tree.close()| >lua

require("nvim-tree.api").tree.close()
<
:NvimTreeToggle |nvim_tree.api.tree.toggle()| >lua

require("nvim-tree.api").tree.toggle({
path = "<args>",
find_file = false,
update_root = false,
focus = true,
})
<
:NvimTreeFocus |nvim_tree.api.tree.open()| >lua

require("nvim-tree.api").tree.open()
<
:NvimTreeRefresh |nvim_tree.api.tree.reload()| >lua

require("nvim-tree.api").tree.reload()
<
:NvimTreeFindFile |nvim_tree.api.tree.find_file()| >lua

require("nvim-tree.api").tree.find_file({
open = true,
update_root = "<bang>",
focus = true,
})
<
:NvimTreeFindFileToggle |nvim_tree.api.tree.toggle()| >lua

require("nvim-tree.api").tree.toggle({
path = "<args>",
find_file = true,
update_root = "<bang>",
focus = true,
})
<
:NvimTreeClipboard |nvim_tree.api.fs.print_clipboard()| >lua

require("nvim-tree.api").fs.print_clipboard()
<
:NvimTreeCollapse |nvim_tree.api.tree.collapse_all()| >lua

require("nvim-tree.api").tree.collapse_all({
keep_buffers = false
})
<
:NvimTreeCollapseKeepBuffers |nvim_tree.api.tree.collapse_all()| >lua

require("nvim-tree.api").tree.collapse_all({
keep_buffers = true
})
<
:NvimTreeHiTest |nvim_tree.api.appearance.hi_test()| >lua

require("nvim-tree.api").appearance.hi_test()
<
:NvimTreeResize |nvim_tree.api.tree.resize()| >lua

local sign = c.args:sub(1, 1)
if sign == "+" or sign == "-" then
require("nvim-tree.api").tree.resize({ relative = tonumber(c.args) })
else
require("nvim-tree.api").tree.resize({ absolute = tonumber(c.args) })
end
<

==============================================================================
Setup nvim-tree-setup

You must run the setup() function once to initialise nvim-tree. It may be
called again to apply a change in configuration without restarting Nvim.

The setup() function takes one optional argument: |nvim_tree.config|. If
omitted nvim-tree will be initialised with default configuration:
|nvim-tree-config-default|.

Config can be validated with |lsp| when passed directly e.g. >lua

require("nvim-tree").setup({
hijack_cursor = true,
})
<
or as a typed variable e.g. >lua

---@type nvim_tree.config
local config = {
hijack_cursor = true,
}
require("nvim-tree").setup(config)
<
The first setup() call is cheap: it does nothing more than validate / apply
the configuration. Nothing happens until the tree is first opened.

Subsequent setup() calls are expensive as they tear down the world before
applying configuration.

==============================================================================
Mappings nvim-tree-mappings

Mappings are set via the |nvim_tree.config| {on_attach} function, which is run upon
creating the nvim-tree buffer. Mappings are usually |nvim-tree-api| functions
however may be your own.

When {on_attach} is not a function, |nvim-tree-mappings-default| will be used.

Active mappings may be viewed via HELP, default g?. The mapping's description
is used when displaying HELP.

The on_attach function is passed the bufnr of nvim-tree. Use
|vim.keymap.set()| or |nvim_set_keymap()| to define mappings as usual. e.g. >lua

local function my_on_attach(bufnr)
local api = require("nvim-tree.api")

local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end

-- copy default mappings here from defaults in next section
vim.keymap.set("n", "<C-]>", api.tree.change_root_to_node, opts("CD"))
vim.keymap.set("n", "<C-e>", api.node.open.replace_tree_buffer, opts("Open: In Place"))
---
-- OR use all default mappings
api.map.on_attach.default(bufnr)

-- remove a default
vim.keymap.del("n", "<C-]>", { buffer = bufnr })

-- override a default
vim.keymap.set("n", "<C-e>", api.tree.reload, opts("Refresh"))

-- add your mappings
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
---
end

require("nvim-tree").setup({
---
on_attach = my_on_attach,
---
})
<
Single left mouse mappings can be achieved via <LeftRelease>.

Single right / middle mouse mappings will require changes to |'mousemodel'| or |'mouse'|.

|vim.keymap.set()| {rhs} is a (function|string) thus it may be necessary to
define your own function to map complex functionality e.g. >lua

local function print_node_path()
local api = require("nvim-tree.api")
local node = api.tree.get_node_under_cursor()
print(node.absolute_path)
end

-- on_attach
vim.keymap.set("n", "<C-P>", print_node_path, opts("Print Path"))
<
==============================================================================
Mappings: Default nvim-tree-mappings-default

In the absence of an |nvim_tree.config| {on_attach} function, the following
defaults will be applied.

You are encouraged to copy these to your {on_attach} function. >lua

local api = require("nvim-tree.api")

local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end

-- BEGIN_ON_ATTACH_DEFAULT
vim.keymap.set("n", "<C-]>", api.tree.change_root_to_node, opts("CD"))
vim.keymap.set("n", "<C-e>", api.node.open.replace_tree_buffer, opts("Open: In Place"))
vim.keymap.set("n", "<C-k>", api.node.show_info_popup, opts("Info"))
vim.keymap.set("n", "<C-r>", api.fs.rename_sub, opts("Rename: Omit Filename"))
vim.keymap.set("n", "<C-t>", api.node.open.tab, opts("Open: New Tab"))
vim.keymap.set("n", "<C-v>", api.node.open.vertical, opts("Open: Vertical Split"))
vim.keymap.set("n", "<C-x>", api.node.open.horizontal, opts("Open: Horizontal Split"))
vim.keymap.set("n", "<BS>", api.node.navigate.parent_close, opts("Close Directory"))
vim.keymap.set("n", "<CR>", api.node.open.edit, opts("Open"))
vim.keymap.set({ "n", "x" }, "<Del>", api.fs.remove, opts("Delete"))
vim.keymap.set("n", "<Tab>", api.node.open.preview, opts("Open Preview"))
vim.keymap.set("n", ">", api.node.navigate.sibling.next, opts("Next Sibling"))
vim.keymap.set("n", "<", api.node.navigate.sibling.prev, opts("Previous Sibling"))
vim.keymap.set("n", ".", api.node.run.cmd, opts("Run Command"))
vim.keymap.set("n", "-", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "a", api.fs.create, opts("Create File Or Directory"))
vim.keymap.set("n", "bd", api.marks.bulk.delete, opts("Delete Bookmarked"))
vim.keymap.set("n", "bt", api.marks.bulk.trash, opts("Trash Bookmarked"))
vim.keymap.set("n", "bmv", api.marks.bulk.move, opts("Move Bookmarked"))
vim.keymap.set("n", "B", api.filter.no_buffer.toggle, opts("Toggle Filter: No Buffer"))
vim.keymap.set({ "n", "x" }, "c", api.fs.copy.node, opts("Copy"))
vim.keymap.set("n", "C", api.filter.git.clean.toggle, opts("Toggle Filter: Git Clean"))
vim.keymap.set("n", "[c", api.node.navigate.git.prev, opts("Prev Git"))
vim.keymap.set("n", "]c", api.node.navigate.git.next, opts("Next Git"))
vim.keymap.set({ "n", "x" }, "d", api.fs.remove, opts("Delete"))
vim.keymap.set({ "n", "x" }, "D", api.fs.trash, opts("Trash"))
vim.keymap.set("n", "E", api.tree.expand_all, opts("Expand All"))
vim.keymap.set("n", "e", api.fs.rename_basename, opts("Rename: Basename"))
vim.keymap.set("n", "]e", api.node.navigate.diagnostics.next, opts("Next Diagnostic"))
vim.keymap.set("n", "[e", api.node.navigate.diagnostics.prev, opts("Prev Diagnostic"))
vim.keymap.set("n", "F", api.filter.live.clear, opts("Live Filter: Clear"))
vim.keymap.set("n", "f", api.filter.live.start, opts("Live Filter: Start"))
vim.keymap.set("n", "g?", api.tree.toggle_help, opts("Help"))
vim.keymap.set({ "n", "x" }, "gy", api.fs.copy.absolute_path, opts("Copy Absolute Path"))
vim.keymap.set("n", "ge", api.fs.copy.basename, opts("Copy Basename"))
vim.keymap.set("n", "H", api.filter.dotfiles.toggle, opts("Toggle Filter: Dotfiles"))
vim.keymap.set("n", "I", api.filter.git.ignored.toggle, opts("Toggle Filter: Git Ignored"))
vim.keymap.set("n", "J", api.node.navigate.sibling.last, opts("Last Sibling"))
vim.keymap.set("n", "K", api.node.navigate.sibling.first, opts("First Sibling"))
vim.keymap.set("n", "L", api.node.open.toggle_group_empty, opts("Toggle Group Empty"))
vim.keymap.set("n", "M", api.filter.no_bookmark.toggle, opts("Toggle Filter: No Bookmark"))
vim.keymap.set({ "n", "x" }, "m", api.marks.toggle, opts("Toggle Bookmark"))
vim.keymap.set("n", "o", api.node.open.edit, opts("Open"))
vim.keymap.set("n", "O", api.node.open.no_window_picker, opts("Open: No Window Picker"))
vim.keymap.set("n", "p", api.fs.paste, opts("Paste"))
vim.keymap.set("n", "gp", api.fs.move, opts("Move"))
vim.keymap.set("n", "P", api.node.navigate.parent, opts("Parent Directory"))
vim.keymap.set("n", "q", api.tree.close, opts("Close"))
vim.keymap.set("n", "r", api.fs.rename, opts("Rename"))
vim.keymap.set("n", "R", api.tree.reload, opts("Refresh"))
vim.keymap.set("n", "s", api.node.run.system, opts("Run System"))
vim.keymap.set("n", "S", api.tree.search_node, opts("Search"))
vim.keymap.set("n", "u", api.fs.rename_full, opts("Rename: Full Path"))
vim.keymap.set("n", "U", api.filter.custom.toggle, opts("Toggle Filter: Custom"))
vim.keymap.set("n", "W", api.tree.collapse_all, opts("Collapse All"))
vim.keymap.set({ "n", "x" }, "x", api.fs.cut, opts("Cut"))
vim.keymap.set("n", "y", api.fs.copy.filename, opts("Copy Name"))
vim.keymap.set("n", "Y", api.fs.copy.relative_path, opts("Copy Relative Path"))
vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open"))
vim.keymap.set("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD"))
-- END_ON_ATTACH_DEFAULT
<
Alternatively, you may apply these default mappings from your
|nvim_tree.config| {on_attach} via |nvim_tree.api.map.on_attach.default()| e.g. >lua

local function my_on_attach(bufnr)
local api = require("nvim-tree.api")

local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end

api.map.on_attach.default(bufnr)

-- your removals and mappings go here
end
<

==============================================================================
Icons And Highlighting nvim-tree-icons-highlighting

Icons may be displayed before files and directories.

Additional icons and highlighting may be displayed to indicate various states
for files and and directories. Highlighting is additive.

Decorators are responsible for providing the icons and highlighting. They
apply additively in order of precedence.

DECORATOR
See |nvim_tree.config.renderer.decorator| for available decorators and their
default precedence.

ICON?
Enable via |nvim_tree.config.renderer.icons.show

REQUIRES
Features that must be enabled to show icons and highlighting.

PLACEMENT
Where to place icons: |nvim_tree.config.renderer.icons.placement|

HIGHLIGHT
What should be highlighted: |nvim_tree.config.renderer.highlight|

DEVICONS?
Glyphs and their colors will be overridden by optional plugin:
nvim-tree/nvim-web-devicons
See |nvim_tree.config.renderer.icons.web_devicons|

GLYPHS
Icon glyphs definitions.

GROUPS
Applicable highlight groups: |nvim-tree-highlight-groups|

Some defaults noted. In ascending order of default decorator additive
precedence:

WHAT DECORATOR ICON? REQUIRES PLACEMENT HIGHLIGHT GLYPHS DEVICONS? GROUPS
File Icon - {file} Y - - - |nvim_tree.config.renderer.icons.glyphs| {default} Y NvimTreeNormal, NvimTreeFileIcon
Folder Icon - {folder} Y - - - |nvim_tree.config.renderer.icons.glyphs.folder| Y NvimTreeFolderName, NvimTreeFolderIcon
Git Status "Git" {git} Y |nvim_tree.config.git| {git_placement} "before" {highlight_git} "none" |nvim_tree.config.renderer.icons.glyphs.git| N NvimTreeGit*
|bufloaded()| "Open" - - - {highlight_opened_files}"none" - N NvimTreeOpened*
Dotfiles "Hidden" {hidden} N - {hidden_placement} "after" {highlight_hidden} "none" |nvim_tree.config.renderer.icons.glyphs| {hidden} N NvimTreeHidden*
|'modified'| "Modified" {modified} Y |nvim_tree.config.modified| {modified_placement} "after" {highlight_modified} "none" |nvim_tree.config.renderer.icons.glyphs| {modified} N NvimTreeModified*
Bookmarked "Bookmark" {bookmarks} Y - {bookmarks_placement} "signcolumn" {highlight_bookmarks} "none" |nvim_tree.config.renderer.icons.glyphs| {bookmark} N NvimTreeBookmark*
Diag Status "Diagnostics" {diagnostics}Y |nvim_tree.config.diagnostics| {diagnostics_placement}"signcolumn" {highlight_diagnostics} "none" |nvim_tree.config.diagnostics.icons| N NvimTreeDiagnostic*
Copied "Copied" - - - {highlight_clipboard} "name" - N NvimTreeCopiedHL
Cut "Cut" - - - {highlight_clipboard} "name" - N NvimTreeCutHL


==============================================================================
Highlight Groups nvim-tree-highlight-groups

All the following highlight groups can be configured by hand. Aside from
NvimTreeWindowPicker, it is not advised to colorize the background of these
groups.

Example |:highlight| >vim
:hi NvimTreeSymlink guifg=blue gui=bold,underline
<
It is recommended to enable |'termguicolors'| for the more pleasant 24-bit
colours.

To view the nvim-tree highlight groups run |:NvimTreeHiTest|

To view all active highlight groups run :so $VIMRUNTIME/syntax/hitest.vim
as per |:highlight|

The *HL groups are additive, following |nvim_tree.config.renderer.decorator|
precedence.
Only present attributes will clobber each other.
In this example a modified, opened file will have magenta text, with cyan
undercurl: >vim
:hi NvimTreeOpenedHL guifg=magenta guisp=red gui=underline
:hi NvimTreeModifiedFileHL guisp=cyan gui=undercurl
<
To prevent usage of a highlight:

- Before setup: link the group to Normal e.g. >vim
:hi NvimTreeExecFile Normal
<
- After setup: link it to NONE, to override the default link e.g. >lua
:hi! link NvimTreeExecFile NONE
<
==============================================================================
Highlight Groups: Default nvim-tree-highlight-groups-default

|:highlight-link| default or |:highlight-default| define the groups on setup:

Standard: >
NvimTreeNormal Normal
NvimTreeNormalFloat NormalFloat
NvimTreeNormalNC NormalFloat

NvimTreeLineNr LineNr
NvimTreeWinSeparator WinSeparator
NvimTreeEndOfBuffer EndOfBuffer
NvimTreePopup Normal
NvimTreeSignColumn NvimTreeNormal

NvimTreeCursorColumn CursorColumn
NvimTreeCursorLine CursorLine
NvimTreeCursorLineNr CursorLineNr

NvimTreeStatusLine StatusLine
NvimTreeStatusLineNC StatusLineNC
<
File Text: >
NvimTreeExecFile SpellCap
NvimTreeImageFile SpellCap
NvimTreeSpecialFile SpellCap
NvimTreeSymlink SpellCap
<
Folder Text: >
NvimTreeRootFolder Title
NvimTreeFolderName Directory
NvimTreeEmptyFolderName Directory
NvimTreeOpenedFolderName Directory
NvimTreeSymlinkFolderName Directory
<
File Icons: >
NvimTreeFileIcon NvimTreeNormal
NvimTreeSymlinkIcon NvimTreeNormal
<
Folder Icons: >
NvimTreeFolderIcon guifg=#8094b4 ctermfg=Blue
NvimTreeOpenedFolderIcon NvimTreeFolderIcon
NvimTreeClosedFolderIcon NvimTreeFolderIcon
NvimTreeFolderArrowClosed NvimTreeIndentMarker
NvimTreeFolderArrowOpen NvimTreeIndentMarker
<
Indent: >
NvimTreeIndentMarker NvimTreeFileIcon
<
Picker: >
NvimTreeWindowPicker guifg=#ededed guibg=#4493c8 gui=bold ctermfg=White ctermbg=Cyan
<
Live Filter: >
NvimTreeLiveFilterPrefix PreProc
NvimTreeLiveFilterValue ModeMsg
<
Clipboard: >
NvimTreeCopiedHL SpellRare
NvimTreeCutHL SpellBad
<
Bookmarks: >
NvimTreeBookmarkIcon NvimTreeFolderIcon
NvimTreeBookmarkHL SpellLocal
<
Modified: >
NvimTreeModifiedIcon Type
NvimTreeModifiedFileHL NvimTreeModifiedIcon
NvimTreeModifiedFolderHL NvimTreeModifiedIcon

Hidden: >
NvimTreeModifiedIcon Conceal
NvimTreeModifiedFileHL NvimTreeHiddenIcon
NvimTreeModifiedFolderHL NvimTreeHiddenFileHL
<
Hidden Display: >
NvimTreeHiddenDisplay Conceal
<
Opened: >
NvimTreeOpenedHL Special
<
Git Icon: >
NvimTreeGitDeletedIcon Statement
NvimTreeGitDirtyIcon Statement
NvimTreeGitIgnoredIcon Comment
NvimTreeGitMergeIcon Constant
NvimTreeGitNewIcon PreProc
NvimTreeGitRenamedIcon PreProc
NvimTreeGitStagedIcon Constant
<
Git File File Highlight: >
NvimTreeGitFileDeletedHL NvimTreeGitDeletedIcon
NvimTreeGitFileDirtyHL NvimTreeGitDirtyIcon
NvimTreeGitFileIgnoredHL NvimTreeGitIgnoredIcon
NvimTreeGitFileMergeHL NvimTreeGitMergeIcon
NvimTreeGitFileNewHL NvimTreeGitNewIcon
NvimTreeGitFileRenamedHL NvimTreeGitRenamedIcon
NvimTreeGitFileStagedHL NvimTreeGitStagedIcon
<
Git Folder Folder Highlight: >
NvimTreeGitFolderDeletedHL NvimTreeGitFileDeletedHL
NvimTreeGitFolderDirtyHL NvimTreeGitFileDirtyHL
NvimTreeGitFolderIgnoredHL NvimTreeGitFileIgnoredHL
NvimTreeGitFolderMergeHL NvimTreeGitFileMergeHL
NvimTreeGitFolderNewHL NvimTreeGitFileNewHL
NvimTreeGitFolderRenamedHL NvimTreeGitFileRenamedHL
NvimTreeGitFolderStagedHL NvimTreeGitFileStagedHL
<
Diagnostics Icon: >
NvimTreeDiagnosticErrorIcon DiagnosticError
NvimTreeDiagnosticWarnIcon DiagnosticWarn
NvimTreeDiagnosticInfoIcon DiagnosticInfo
NvimTreeDiagnosticHintIcon DiagnosticHint
<
Diagnostics File Highlight: >
NvimTreeDiagnosticErrorFileHL DiagnosticUnderlineError
NvimTreeDiagnosticWarnFileHL DiagnosticUnderlineWarn
NvimTreeDiagnosticInfoFileHL DiagnosticUnderlineInfo
NvimTreeDiagnosticHintFileHL DiagnosticUnderlineHint
<
Diagnostics Folder Highlight: >
NvimTreeDiagnosticErrorFolderHL NvimTreeDiagnosticErrorFileHL
NvimTreeDiagnosticWarnFolderHL NvimTreeDiagnosticWarnFileHL
NvimTreeDiagnosticInfoFolderHL NvimTreeDiagnosticInfoFileHL
NvimTreeDiagnosticHintFolderHL NvimTreeDiagnosticHintFileHL
<
==============================================================================
Events nvim-tree-events

nvim-tree will dispatch events whenever an action is made. These events can be
subscribed to through handler functions. This allows for even further
customization of nvim-tree.

A handler for an event is just a function which receives one argument, the
payload of the event. The payload is different for each event type. Refer
to |nvim_tree_registering_handlers| for more information.

nvim_tree_registering_handlers

Handlers are registered by calling |nvim_tree.api.events.subscribe()| function
with an |nvim_tree_events_kind|.

e.g. handler for node renamed: >lua

local api = require("nvim-tree.api")
local Event = api.events.Event

api.events.subscribe(Event.NodeRenamed, function(data)
print("Node renamed from " .. data.old_name .. " to " .. data.new_name)
end)
<
nvim_tree_events_kind

- Event.Ready
When NvimTree has been initialized.
• Note: Handler takes no parameter.

- Event.TreePreOpen
Invoked before the window and buffer for NvimTree are created
or opened. Before Event.TreeOpen
• Note: Handler takes no parameter.

- Event.TreeOpen
Invoked after the NvimTree is opened.
• Note: Handler takes no parameter.

- Event.TreeClose
Invoked after the NvimTree is closed, but before the window is
closed. Dispatched on |WinClosed| event for NvimTree window.
• Note: Handler takes no parameter.

- Event.Resize - When NvimTree is resized.
handler parameters: ~
size: number size of the view in columns.

- Event.WillRenameNode
• Note: A node can either be a file or a directory.
handler parameters: ~
{old_name} {string} Absolute path to the old node location.
{new_name} {string} Absolute path to the new node location.

- Event.NodeRenamed
• Note: A node can either be a file or a directory.
handler parameters: ~
{old_name} {string} Absolute path to the old node location.
{new_name} {string} Absolute path to the new node location.

- Event.FileCreated
handler parameters: ~
{fname} {string} Absolute path to the created file

- Event.WillCreateFile
handler parameters: ~
{fname} {string} Absolute path to the file to be
created

- Event.FileRemoved
handler parameters: ~
{fname} {string} Absolute path to the removed file.

- Event.WillRemoveFile
handler parameters: ~
{fname} {string} Absolute path to the file to be
removed

- Event.FolderCreated
handler parameters: ~
{folder_name} {string} Absolute path to the created folder.

- Event.FolderRemoved
handler parameters: ~
{folder_name} {string} Absolute path to the removed folder.

- Event.TreeAttachedPost
Invoked after the tree's buffer has been created and mappings
have been applied: |nvim-tree-mappings| or |nvim_tree.config| {on_attach}
handler parameters: ~
{buf} {number} API buffer handle (buffer number)

- Event.TreeRendered
Invoked every time the tree is redrawn. Normally this event
happens after Event.TreeOpen except that handlers of this
one will have access to the tree buffer populated with the
final content.
handler parameters: ~
{bufnr} {number} API buffer handle (buffer number)
{winnr} {number} API window handle (window number)

nvim_tree_events_startup

There are two special startup events in the form of User autocommands:

NvimTreeRequired first require("nvim-tree")
NvimTreeSetup setup({}) completed

Immediately before firing: a global variable of the same name will be set to a
value of 1.

Example subscription: >lua

vim.api.nvim_create_autocmd("User", {
pattern = "NvimTreeRequired",
callback = function(data)
---
end,
})
<
==============================================================================
Prompts nvim-tree-prompts

Some NvimTree actions use the builtin |vim.ui.select()| prompt API for
confirmations when the |nvim_tree.config| {select_prompts} option is set.

The API accepts the optional kind key as part of the {opts} parameter, which
can can be used to identify the type of prompt, to allow user side
configurations for different types of prompts.

- nvimtree_overwrite_rename
overwrite or rename during |nvim_tree.api.fs.paste()|

- nvimtree_remove
delete during |nvim_tree.api.fs.remove()|

- nvimtree_trash
send to trash during |nvim_tree.api.fs.trash()|

- nvimtree_bulk_delete
delete all bookmarked during |nvim_tree.api.marks.bulk.delete()|

- nvimtree_bulk_trash
send all bookmarked to trash during |nvim_tree.api.marks.bulk.trash()|

==============================================================================
OS Specific Restrictions nvim-tree-os-specific

Windows WSL and PowerShell
- Trash is synchronized
- Executable file detection is disabled as this is non-performant and can
freeze Nvim
- Some filesystem watcher error related to permissions will not be reported
- Filesystem watchers can experience severe performance issues. It is strongly
recommended to tightly control watcher usage via
|nvim_tree.config.filesystem_watchers| {whitelist_dirs}

Powershell
- Observed Nvim hanging after a runaway (infinite) number of events on a
single directory. See |nvim_tree.config.filesystem_watchers| {max_events}

==============================================================================
netrw nvim-tree-netrw

|netrw| is a standard Nvim plugin that is enabled by default. It provides,
amongst other functionality, a file/directory browser.

It interferes with nvim-tree and the intended user experience is nvim-tree
replacing the |netrw| browser.

It is strongly recommended to disable |netrw|. As it is a bundled plugin it
must be disabled manually at the start of your init.lua as per |netrw-noload|: >lua

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
<
There are many |netrw| features beyond the file browser. If you want to
keep using |netrw| without its browser features please ensure:

|nvim_tree.config| {disable_netrw} = false
|nvim_tree.config| {hijack_netrw} = true

==============================================================================
Legacy nvim-tree-legacy

Backwards compatible, silent refactors have been done.

==============================================================================
Legacy: Config nvim-tree-legacy-config

Legacy config is translated to the current, making type and value changes as
needed.

update_cwd |nvim_tree.config| {sync_root_with_cwd}
update_focused_file.update_cwd |nvim_tree.config.update_focused_file| {update_root}
open_on_tab |nvim_tree.config.tab.sync| {open}
ignore_buf_on_tab_change |nvim_tree.config.tab.sync| {ignore}
renderer.root_folder_modifier |nvim_tree.config.renderer| {root_folder_label}
update_focused_file.debounce_delay |nvim_tree.config.view| {debounce_delay}
trash.require_confirm |nvim_tree.config.ui.confirm| {trash}
view.adaptive_size |nvim_tree.config.view| {width}
sort_by |nvim_tree.config.sort| {sorter}
git.ignore |nvim_tree.config.filters| {git_ignored}
renderer.icons.webdev_colors |nvim_tree.config.renderer.icons.web_devicons.file| {color}
renderer.icons.padding |nvim_tree.config.renderer.icons.padding| {icon}

==============================================================================
Legacy: API nvim-tree-legacy-api

Deprecated API with unchanged function signature:

api.config.mappings.get_keymap |nvim_tree.api.map.keymap.current()|
api.config.mappings.get_keymap_default |nvim_tree.api.map.keymap.default()|
api.config.mappings.default_on_attach |nvim_tree.api.map.on_attach.default()|

api.diagnostics.hi_test |nvim_tree.api.appearance.hi_test()|

api.live_filter.start |nvim_tree.api.filter.live.start()|
api.live_filter.clear |nvim_tree.api.filter.live.clear()|

api.tree.toggle_enable_filters |nvim_tree.api.filter.toggle()|
api.tree.toggle_gitignore_filter |nvim_tree.api.filter.git.ignored.toggle()|
api.tree.toggle_git_clean_filter |nvim_tree.api.filter.git.clean.toggle()|
api.tree.toggle_no_buffer_filter |nvim_tree.api.filter.no_buffer.toggle()|
api.tree.toggle_custom_filter |nvim_tree.api.filter.custom.toggle()|
api.tree.toggle_hidden_filter |nvim_tree.api.filter.dotfiles.toggle()|
api.tree.toggle_no_bookmark_filter |nvim_tree.api.filter.no_bookmark.toggle()|

==============================================================================
Legacy: Highlight nvim-tree-legacy-highlight

Legacy highlight group are still obeyed when they are defined and the current
highlight group is not, hard linking as follows: >

NvimTreeModifiedIcon NvimTreeModifiedFile
NvimTreeOpenedHL NvimTreeOpenedFile
NvimTreeBookmarkIcon NvimTreeBookmark

NvimTreeGitDeletedIcon NvimTreeGitDeleted
NvimTreeGitDirtyIcon NvimTreeGitDirty
NvimTreeGitIgnoredIcon NvimTreeGitIgnored
NvimTreeGitMergeIcon NvimTreeGitMerge
NvimTreeGitNewIcon NvimTreeGitNew
NvimTreeGitRenamedIcon NvimTreeGitRenamed
NvimTreeGitStagedIcon NvimTreeGitStaged

NvimTreeGitFileDeletedHL NvimTreeFileDeleted
NvimTreeGitFileDirtyHL NvimTreeFileDirty
NvimTreeGitFileIgnoredHL NvimTreeFileIgnored
NvimTreeGitFileMergeHL NvimTreeFileMerge
NvimTreeGitFileNewHL NvimTreeFileNew
NvimTreeGitFileRenamedHL NvimTreeFileRenamed
NvimTreeGitFileStagedHL NvimTreeFileStaged

NvimTreeGitFolderDeletedHL NvimTreeFolderDeleted
NvimTreeGitFolderDirtyHL NvimTreeFolderDirty
NvimTreeGitFolderIgnoredHL NvimTreeFolderIgnored
NvimTreeGitFolderMergeHL NvimTreeFolderMerge
NvimTreeGitFolderNewHL NvimTreeFolderNew
NvimTreeGitFolderRenamedHL NvimTreeFolderRenamed
NvimTreeGitFolderStagedHL NvimTreeFolderStaged

NvimTreeLspDiagnosticsError NvimTreeDiagnosticErrorIcon
NvimTreeLspDiagnosticsWarning NvimTreeDiagnosticWarnIcon
NvimTreeLspDiagnosticsInformation NvimTreeDiagnosticInfoIcon
NvimTreeLspDiagnosticsHint NvimTreeDiagnosticHintIcon

NvimTreeLspDiagnosticsErrorText NvimTreeDiagnosticErrorFileHL
NvimTreeLspDiagnosticsWarningText NvimTreeDiagnosticWarnFileHL
NvimTreeLspDiagnosticsInformationText NvimTreeDiagnosticInfoFileHL
NvimTreeLspDiagnosticsHintText NvimTreeDiagnosticHintFileHL

NvimTreeLspDiagnosticsErrorFolderText NvimTreeDiagnosticErrorFolderHL
NvimTreeLspDiagnosticsWarningFolderText NvimTreeDiagnosticWarnFolderHL
NvimTreeLspDiagnosticsInformationFolderText NvimTreeDiagnosticInfoFolderHL
NvimTreeLspDiagnosticsHintFolderText NvimTreeDiagnosticHintFolderHL
<


==============================================================================
Config nvim-tree-config

nvim_tree.config
Arguments to pass to |nvim-tree-setup|.

When a value is not present/nil, the default will be used.

{on_attach} Runs when creating the nvim-tree buffer. Use this to set your
|nvim-tree-mappings|. When not a function, |nvim-tree-mappings-default|
will be used.

{hijack_cursor} keep the cursor on the first letter of the filename when
moving in the tree.

{auto_reload_on_write} reload the explorer every time a buffer is written
to.

{disable_netrw} completely disables |netrw|, see |nvim-tree-netrw| for
details. It is strongly advised to eagerly disable netrw, due to race
conditions at vim startup.

{hijack_netrw} hijacks netrw windows, ignored when {disable_netrw}.

{hijack_unnamed_buffer_when_opening} opens in place of the unnamed buffer
if it's empty.

{root_dirs} preferred root directories, requires
|nvim_tree.config.update_focused_file.update_root|.

{prefer_startup_root} prefer startup root directory when updating root
directory of the tree. Requires
|nvim_tree.config.update_focused_file.update_root|.

{sync_root_with_cwd} changes the tree root directory on |DirChanged| and
refreshes the tree.

{reload_on_bufenter} automatically reloads the tree on |BufEnter|
nvim-tree.

{respect_buf_cwd} changes the |current-directory| of nvim-tree to that of
new buffer's when opening nvim-tree.

{select_prompts} uses |vim.ui.select()| style prompts. Necessary when
using a UI prompt decorator such as dressing.nvim or
telescope-ui-select.nvim

Fields: ~
• {actions}? (nvim_tree.config.actions)
|nvim_tree.config.actions|
• {auto_reload_on_write}? (boolean) (default: true)
• {bookmarks}? (nvim_tree.config.bookmarks)
|nvim_tree.config.bookmarks|
• {diagnostics}? (nvim_tree.config.diagnostics)
|nvim_tree.config.diagnostics|
• {disable_netrw}? (boolean) (default: false)
• {experimental}? (nvim_tree.config.experimental)
|nvim_tree.config.experimental|
• {filesystem_watchers}? (nvim_tree.config.filesystem_watchers)
|nvim_tree.config.filesystem_watchers|
• {filters}? (nvim_tree.config.filters)
|nvim_tree.config.filters|
• {git}? (nvim_tree.config.git)
|nvim_tree.config.git|
• {help}? (nvim_tree.config.help)
|nvim_tree.config.help|
• {hijack_cursor}? (boolean) (default: false)
• {hijack_directories}? (nvim_tree.config.hijack_directories)
|nvim_tree.config.hijack_directories|
• {hijack_netrw}? (boolean) (default: true)
• {hijack_unnamed_buffer_when_opening}? (boolean) (default: false)
• {live_filter}? (nvim_tree.config.live_filter)
|nvim_tree.config.live_filter|
• {log}? (nvim_tree.config.log)
|nvim_tree.config.log|
• {modified}? (nvim_tree.config.modified)
|nvim_tree.config.modified|
• {notify}? (nvim_tree.config.notify)
|nvim_tree.config.notify|
• {on_attach}? ("default"|(fun(bufnr: integer)))
(default: default)
• {prefer_startup_root}? (boolean) (default: false)
• {reload_on_bufenter}? (boolean) (default: false)
• {renderer}? (nvim_tree.config.renderer)
|nvim_tree.config.renderer|
• {respect_buf_cwd}? (boolean) (default: false)
• {root_dirs}? (string[]) (default: {})
• {select_prompts}? (boolean) (default: false)
• {sort}? (nvim_tree.config.sort)
|nvim_tree.config.sort|
• {sync_root_with_cwd}? (boolean) (default: false)
• {tab}? (nvim_tree.config.tab)
|nvim_tree.config.tab|
• {trash}? (nvim_tree.config.trash)
|nvim_tree.config.trash|
• {ui}? (nvim_tree.config.ui)
|nvim_tree.config.ui|
• {update_focused_file}? (nvim_tree.config.update_focused_file)
|nvim_tree.config.update_focused_file|
• {view}? (nvim_tree.config.view)
|nvim_tree.config.view|

==============================================================================
Config: sort nvim-tree-config-sort

nvim_tree.config.sort
Sort files within a directory.

{sorter} presets nvim_tree.config.sort.Sorter
"name"
"case_sensitive" name
"modification_time"
"extension" uses all suffixes e.g. foo.tar.gz -> .tar.gz
"suffix" uses the last e.g. foo.tar.gz -> .gz
"filetype" |filetype|

{sorter} may be a function that is passed a list of nvim_tree.api.Node
to be sorted in place e.g. >lua

---Sort by name length
---@param nodes nvim_tree.api.Node[]
---@return nvim_tree.config.sort.Sorter?
local sorter = function(nodes)
table.sort(nodes, function(a, b)
return #a.name < #b.name
end)
end
<

{sorter} may be a function that returns a |nvim_tree.config.sort.Sorter|

Fields: ~
• {files_first}? (boolean, default: false) Sort files before
folders. Has no effect when {sorter} is a function.
Overrides {folders_first}.
• {folders_first}? (boolean, default: true) Sort folders before
files. Has no effect when {sorter} is a function.
• {sorter}? (nvim_tree.config.sort.Sorter|(fun(nodes: nvim_tree.api.Node[]): nvim_tree.config.sort.Sorter?))
(default: "name")

==============================================================================
Config: view nvim-tree-config-view

nvim_tree.config.view
Configures the dimensions and appearance of the nvim-tree window.

The window is "docked" at the left by default, however may be configured
to float: |nvim_tree.config.view.float|

{width} can be a |nvim_tree.config.view.width.spec| for static control or
a |nvim_tree.config.view.width| for fully dynamic control based on longest
line.

nvim_tree.config.view.width.spec
string: x% string e.g. 30%
integer: number of columns
function: returns one of the above

Fields: ~
• {centralize_selection}? (boolean, default: false) When
entering nvim-tree, reposition the
view so that the current node is
initially centralized, see |zz|.
• {cursorline}? (boolean, default: true)
|'cursorline'|
• {cursorlineopt}? (string, default: both)
|'cursorlineopt'|
• {debounce_delay}? (integer, default: 15) Idle
milliseconds before some reload /
refresh operations. Increase if you
experience performance issues around
screen refresh.
• {float}? (nvim_tree.config.view.float)
|nvim_tree.config.view.float|
• {number}? (boolean, default: false)
|'number'|
• {preserve_window_proportions}? (boolean, default: false)
Preserves window proportions when
opening a file. If false, the height
and width of windows other than
nvim-tree will be equalized.
• {relativenumber}? (boolean, default: false)
|'relativenumber'|
• {side}? ("left"|"right") (default: "left")
• {signcolumn}? ("yes"|"auto"|"no", default:
"yes") |'signcolumn'|
• {width}? (nvim_tree.config.view.width.spec|nvim_tree.config.view.width)
(default: 30)

nvim_tree.config.view.float
Configure floating window behaviour

{open_win_config} is passed to |nvim_open_win()|, default: >lua
{
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
}
<

Fields: ~
• {enable}? (boolean) (default: false)
• {open_win_config}? (vim.api.keyset.win_config|(fun(): vim.api.keyset.win_config))
(default:
{ relative = "editor", border = "rounded", width = 30, height = 30, row = 1, col = 1, })
• {quit_on_focus_loss}? (boolean, default: true) Close the floating
window when it loses focus.

nvim_tree.config.view.width
Configure dynamic width based on longest line.

Fields: ~
• {lines_excluded}? (("root")[], default: { "root" }) Exclude these
lines when computing width.
• {max}? (nvim_tree.config.view.width.spec, default: -1)
-1 for unbounded.
• {min}? (nvim_tree.config.view.width.spec) (default:
30)
• {padding}? (nvim_tree.config.view.width.spec, default: 1)
Extra padding to the right.

==============================================================================
Config: renderer nvim-tree-config-renderer

nvim_tree.config.renderer
Controls the appearance of the tree.

{highlight_} nvim_tree.config.renderer.highlight

See |nvim-tree-icons-highlighting|
"none": no highlighting
"icon": icon only
"name": name only
"all": icon and name

{decorators} nvim_tree.config.renderer.decorator

See |nvim-tree-icons-highlighting|

A builtin decorator name string or |nvim_tree.api.Decorator| class.

Builtin decorators in their default order:
"Git"
"Open"
"Hidden"
"Modified"
"Bookmark"
"Diagnostics"
"Copied"
"Cut"

Specify {decorators} is a list e.g. { "Git", MyDecorator, "Cut" }

{root_folder_label} nvim_tree.config.renderer.root_folder_label

Controls the root folder name and visibility:
string: |filename-modifiers| format string, default ":~:s?$?/..?"
false: to disable
fun(root_cwd: string): string: return a literal string from root's
absolute path e.g. >lua
my_root_folder_label = function(path)
return ".../" .. vim.fn.fnamemodify(path, ":t")
end
<

{hidden_display} nvim_tree.config.renderer.hidden_display

Summary of hidden nodes, below the last node in the directory, highlighted
with NvimTreeHiddenDisplay.
"none": disabled, default
"simple": total number of hidden files e.g.
• (3 hidden)
"all": total and by reason: the filter that hid the node e.g.
• (14 total git: 5, dotfile: 9)
(fun(hidden_stats: nvim_tree.config.renderer.hidden_stats): string)

See |nvim_tree.config.renderer.hidden_stats| for details and example.

Fields: ~
• {add_trailing}? (boolean, default: false) Appends a
trailing slash to folder and symlink folder
target names.
• {decorators}? (nvim_tree.config.renderer.decorator[], default: { "Git", "Open", "Hidden", "Modified", "Bookmark", "Diagnostics", "Copied", "Cut", })
List in order of additive precedence.
• {full_name}? (boolean, default: false) Display nodes
whose name length is wider than the width
of nvim-tree window in floating window.
• {group_empty}? (boolean|(fun(relative_path: string): string), default: false)
Compact folders that only contain a single
folder into one node. Function variant
takes the relative path of grouped folders
and returns a string to be displayed.
• {hidden_display}? (nvim_tree.config.renderer.hidden_display, default: none)
|nvim_tree.config.renderer.hidden_display|
• {highlight_bookmarks}? (nvim_tree.config.renderer.highlight)
(default: "none")
• {highlight_clipboard}? (nvim_tree.config.renderer.highlight)
(default: "name")
• {highlight_diagnostics}? (nvim_tree.config.renderer.highlight)
(default: "none")
• {highlight_git}? (nvim_tree.config.renderer.highlight)
(default: "none")
• {highlight_hidden}? (nvim_tree.config.renderer.highlight)
(default: "none")
• {highlight_modified}? (nvim_tree.config.renderer.highlight)
(default: "none")
• {highlight_opened_files}? (nvim_tree.config.renderer.highlight)
(default: "none")
• {icons}? (nvim_tree.config.renderer.icons)
|nvim_tree.config.renderer.icons|
• {indent_markers}? (nvim_tree.config.renderer.indent_markers)
|nvim_tree.config.renderer.indent_markers|
• {indent_width}? (integer, default: 2) Number of spaces
for each tree nesting level. Minimum 1.
• {root_folder_label}? (nvim_tree.config.renderer.root_folder_label, default: ":~:s?$?/..?")
|nvim_tree.config.renderer.root_folder_label|
• {special_files}? (string[], default: { "Cargo.toml", "Makefile", "README.md", "readme.md", })
Highlight special files and directories
with NvimTreeSpecial*.
• {symlink_destination}? (boolean, default: true) Appends an
arrow followed by the target of the
symlink.

nvim_tree.config.renderer.hidden_stats
Number of hidden nodes in a directory by reason: the filter that hid the
node.

Passed to your |nvim_tree.config.renderer.hidden_display| function e.g. >lua

---@param hidden_stats nvim_tree.config.renderer.hidden_stats
---@return string? summary
local my_hidden_display = function(hidden_stats)
local total_count = 0
for reason, count in pairs(hidden_stats) do
total_count = total_count + count
end

if total_count > 0 then
return "(" .. tostring(total_count) .. " hidden)"
end
return nil
end
<

Fields: ~
• {bookmark} (integer)
• {buf} (integer)
• {custom} (integer)
• {dotfile} (integer)
• {git} (integer)
• {live_filter} (integer)

nvim_tree.config.renderer.icons
Icons and separators

{_placement} nvim_tree.config.renderer.icons.placement
"before": before file/folder, after the file/folders icons
"after": after file/folder
"signcolumn": far left, requires |nvim_tree.config.view| {signcolumn}.
"right_align": far right

Fields: ~
• {bookmarks_placement}? (nvim_tree.config.renderer.icons.placement)
(default: signcolumn)
• {diagnostics_placement}? (nvim_tree.config.renderer.icons.placement)
(default: signcolumn)
• {git_placement}? (nvim_tree.config.renderer.icons.placement)
(default: before)
• {glyphs}? (nvim_tree.config.renderer.icons.glyphs)
|nvim_tree.config.renderer.icons.glyphs|
• {hidden_placement}? (nvim_tree.config.renderer.icons.placement)
(default: after)
• {modified_placement}? (nvim_tree.config.renderer.icons.placement)
(default: after)
• {padding}? (table)
nvim_tree.config.renderer.icons.padding
• {folder_arrow}? (string, default: " ")
Between folder arrow icon and file/folder
icon.
• {icon}? (string, default: " ") Between
icon and filename.
• {show}? (nvim_tree.config.renderer.icons.show)
|nvim_tree.config.renderer.icons.show|
• {symlink_arrow}? (string, default: " ➛ ") Separator
between symlink source and target.
• {web_devicons}? (nvim_tree.config.renderer.icons.web_devicons)
|nvim_tree.config.renderer.icons.web_devicons|

nvim_tree.config.renderer.icons.glyphs
See |nvim-tree-icons-highlighting|.

Glyphs that appear in the sign column must have length <= 2

Fields: ~
• {bookmark}? (string) (default: "󰆤")
• {default}? (string, default: "") Files
• {folder}? (table) nvim_tree.config.renderer.icons.glyphs.folder
• {arrow_closed}? (string) (default: left arrow)
• {arrow_open}? (string) (default: down arrow)
• {default}? (string) (default: "")
• {empty}? (string) (default: "")
• {empty_open}? (string) (default: "")
• {open}? (string) (default: "")
• {symlink}? (string) (default: "")
• {symlink_open}? (string) (default: "")
• {git}? (table) nvim_tree.config.renderer.icons.glyphs.git
• {deleted}? (string) (default: "")
• {ignored}? (string) (default: "◌")
• {renamed}? (string) (default: "➜")
• {staged}? (string) (default: "✓")
• {unmerged}? (string) (default: "")
• {unstaged}? (string) (default: "✗")
• {untracked}? (string) (default: "★")
• {hidden}? (string) (default: "󰜌")
• {modified}? (string) (default: "●")
• {symlink}? (string) (default: "")

nvim_tree.config.renderer.icons.show
See |nvim-tree-icons-highlighting|.

Fields: ~
• {bookmarks}? (boolean) (default: true)
• {diagnostics}? (boolean) (default: true)
• {file}? (boolean) (default: true)
• {folder}? (boolean) (default: true)
• {folder_arrow}? (boolean, default: true) Show a small arrow
before the folder node. Arrow will be a part of the
node when using
|nvim_tree.config.renderer.indent_markers|.
• {git}? (boolean) (default: true)
• {hidden}? (boolean) (default: false)
• {modified}? (boolean) (default: true)

nvim_tree.config.renderer.icons.web_devicons
Configure optional plugin nvim-tree/nvim-web-devicons, see
|nvim-tree-icons-highlighting|.

Fields: ~
• {file}? (table)
nvim_tree.config.renderer.icons.web_devicons.file
• {color}? (boolean) (default: true)
• {enable}? (boolean) (default: true)
• {folder}? (table)
nvim_tree.config.renderer.icons.web_devicons.folder
• {color}? (boolean) (default: true)
• {enable}? (boolean) (default: false)

nvim_tree.config.renderer.indent_markers

Fields: ~
• {enable}? (boolean, default: false) Display indent markers
when folders are open.
• {icons}? (table)
nvim_tree.config.renderer.indent_markers.icons
Before the file/directory, length 1.
• {bottom}? (string) (default: "─")
• {corner}? (string) (default: "└")
• {edge}? (string) (default: "│")
• {item}? (string) (default: "│")
• {none}? (string) (default: " ")
• {inline_arrows}? (boolean, default: true) Display folder arrows
in the same column as indent marker when using
|nvim_tree.config.renderer.icons.padding|
{folder_arrow}

==============================================================================
Config: hijack_directories nvim-tree-config-hijack-directories

nvim_tree.config.hijack_directories
Hijack directory buffers by replacing the directory buffer with the tree.

Disable this option if you use vim-dirvish or dirbuf.nvim.

If |nvim_tree.config| {hijack_netrw} and {disable_netrw} are false this
feature will be disabled.

Fields: ~
• {auto_open}? (boolean, default: true) Open if the tree was
previously closed.
• {enable}? (boolean) (default: true)

==============================================================================
Config: update_focused_file nvim-tree-config-update-focused-file

nvim_tree.config.update_focused_file
Update the focused file on |BufEnter|, uncollapsing folders recursively.

Fields: ~
• {enable}? (boolean) (default: false)
• {exclude}? (boolean|(fun(args: vim.api.keyset.create_autocmd.callback_args): boolean), default: false)
A function called on |BufEnter| that returns true if
the file should not be focused when opening.
• {update_root}? (nvim_tree.config.update_focused_file.update_root)
|nvim_tree.config.update_focused_file.update_root|

nvim_tree.config.update_focused_file.update_root
Update the root directory of the tree if the file is not under the current
root directory.

Prefers vim's cwd and |nvim_tree.config| {root_dirs}, falling back to the
directory containing the file.

Requires |nvim_tree.config.update_focused_file|

Fields: ~
• {enable}? (boolean) (default: false)
• {ignore_list}? (string[], default: {}) List of buffer names and
filetypes that will not update the root dir of the
tree if the file isn't found under the current root
directory.

==============================================================================
Config: git nvim-tree-config-git

nvim_tree.config.git
Git operations are run in the background thus status may not immediately
appear.

Processes will be killed if they exceed {timeout} ms. Git integration will
be disabled following 5 timeouts and you will be notified.

Git integration may be disabled for git top-level directories via
{disable_for_dirs}:
• A list of relative paths evaluated with |fnamemodify()| :p OR
• A function that is passed an absolute path and returns true to disable

See |nvim-tree-icons-highlighting|.

Fields: ~
• {cygwin_support}? (boolean, default: false) Use cygpath if
available to resolve paths for git.
• {disable_for_dirs}? (string[]|(fun(path: string): boolean),
default: {}) Disable for top level paths.
• {enable}? (boolean) (default: true)
• {show_on_dirs}? (boolean, default: true) Show status icons
of children when directory itself has no status
icon
• {show_on_open_dirs}? (boolean, default: true) Show status icons
of children on directories that are open.
Requires {show_on_dirs}.
• {timeout}? (integer, default: 400) git processes
timeout milliseconds.

==============================================================================
Config: diagnostics nvim-tree-config-diagnostics

nvim_tree.config.diagnostics
Integrate with |lsp| or COC diagnostics.

See |nvim-tree-icons-highlighting|.

Fields: ~
• {debounce_delay}? (integer, default: 500) Idle milliseconds
between diagnostic event and tree update.
• {diagnostic_opts}? (boolean, default: false) Global
|vim.diagnostic.Opts| overrides {severity} and
{icons}
• {enable}? (boolean) (default: false)
• {icons}? (table) nvim_tree.config.diagnostics.icons
• {error}? (string) (default: "" )
• {hint}? (string) (default: "" )
• {info}? (string) (default: "" )
• {warning}? (string) (default: "" )
• {severity}? (table)
nvim_tree.config.diagnostics.severity
• {max}? (vim.diagnostic.Severity, default:
ERROR) |vim.diagnostic.severity|
• {min}? (vim.diagnostic.Severity, default:
HINT) |vim.diagnostic.severity|
• {show_on_dirs}? (boolean, default: false) Show diagnostic
icons on parent directories.
• {show_on_open_dirs}? (boolean, default: true) Show diagnostics
icons on directories that are open. Requires
{show_on_dirs}.

==============================================================================
Config: modified nvim-tree-config-modified

nvim_tree.config.modified
Indicate which files have unsaved modification. To see modified status in
the tree you will need:
• |nvim_tree.config.renderer.icons.show| {modified} OR
• |nvim_tree.config.renderer| {highlight_modified}

See |nvim-tree-icons-highlighting|.

Fields: ~
• {enable}? (boolean) (default: false)
• {show_on_dirs}? (boolean, default: true) Show modified
indication on directory whose children are
modified.
• {show_on_open_dirs}? (boolean, default: false) Show modified
indication on open directories. Requires
{show_on_dirs}.

==============================================================================
Config: filters nvim-tree-config-filters

nvim_tree.config.filters
Filters may be applied to the tree to exclude the display of
file/directories.

Multiple filters may be applied at once.

Filters can be set at startup or toggled live via API with default
mappings.

I {git_ignored} |nvim_tree.api.filter.git.ignored.toggle()|
Ignore files based on .gitignore. Requires |nvim_tree.config.git|

H {dotfiles} |nvim_tree.api.filter.dotfiles.toggle()|
Filter dotfiles: files/directories starting with a .

C {git_clean} |nvim_tree.api.filter.git.clean.toggle()|
Filter files with no git status. .gitignore files will not be filtered
when {git_ignored}, as they are effectively dirty.

B {no_buffer} |nvim_tree.api.filter.no_buffer.toggle()|
Filter files that have no |buflisted()| buffer. For performance reasons
buffer delete/wipe may not be immediately shown. A reload or filesystem
event will always result in an update.

M {no_bookmark} |nvim_tree.api.filter.no_bookmark.toggle()|
Filter files that are not bookmarked. Enabling this is not useful as there
is no means yet to persist bookmarks.

U {custom} |nvim_tree.api.filter.custom.toggle()|
Disable specific file/directory names via:
• a list of backslash escaped |regular-expression| e.g. "^\\.git""
• a function passed the absolute path of the directory.

All filters including live filter may be disabled via {enable} and toggled
with |nvim_tree.api.filter.toggle()|

Files/directories may be {exclude}d from filtering: they will always be
shown, overriding {git_ignored}, {dotfiles} and {custom}.

Fields: ~
• {custom}? (string[]|(fun(absolute_path: string): boolean))
(default: {})
• {dotfiles}? (boolean) (default: false)
• {enable}? (boolean, default: true) Enable all filters.
• {exclude}? (string[]) (default: {})
• {git_clean}? (boolean) (default: false)
• {git_ignored}? (boolean) (default: true)
• {no_bookmark}? (boolean) (default: false)
• {no_buffer}? (boolean) (default: false)

==============================================================================
Config: live_filter nvim-tree-config-live-filter

nvim_tree.config.live_filter
Live filter allows you to filter the tree nodes dynamically using
|regular-expression| matching.

This feature is bound to the f key by default. The filter can be cleared
with the F key by default.

Fields: ~
• {always_show_folders}? (boolean, default: true) Whether to filter
folders or not.
• {prefix}? (string, default: "[FILTER]: ") Prefix of
the filter displayed in the buffer.

==============================================================================
Config: filesystem_watchers nvim-tree-config-filesystem-watchers

nvim_tree.config.filesystem_watchers
Use file system watchers (libuv uv_fs_event_t) to monitor the filesystem
for changes and update the tree.

With this feature, the tree will be partially updated on specific
directory changes, resulting in better performance.

Blacklist watching absolute directory paths via {ignore_dirs} and
optionally whitelist via {whitelist_dirs}:
• A table of |regular-expression| that will be passed to vim.fn.match
• Backslashes must be escaped e.g. "my-proj/\\.build$"
• Literal backslashes must be double escaped to avoid |/magic| e.g.
"C:\\\\src\\\\my-proj"
• OR a fun(path: string): boolean that is passed an absolute path:
• {ignore_dirs}: return true to disable
• {whitelist_dirs}: return true to enable

{whitelist_dirs} is STRONGLY recommended for windows:
|nvim-tree-os-specific|.

After {max_events} consecutive filesystem events on a single directory
with an interval < {debounce_delay}:
• The filesystem watcher will be disabled for that directory.
• A warning notification will be shown.
• Consider adding this directory to {ignore_dirs}

By default, {max_events} is only enabled for windows.

Fields: ~
• {debounce_delay}? (integer, default: 50) Idle milliseconds
between filesystem change and tree update.
• {enable}? (boolean) (default: true)
• {ignore_dirs}? (string[]|(fun(path: string): boolean), default: { "/.ccls-cache", "/build", "/node_modules", "/target", "/.zig-cache"})
Disable for specific directories.
• {max_events}? (integer, default: 0 or 1000 on windows)
Disable for a single directory after {max_events}
consecutive events with an interval <
{debounce_delay}. Set to 0 to allow unlimited
consecutive events.
• {whitelist_dirs}? (string[]|(fun(path: string): boolean), default:
{}) Optionally enable only for specific
directories.

==============================================================================
Config: actions nvim-tree-config-actions

nvim_tree.config.actions

Fields: ~
• {change_dir}? (nvim_tree.config.actions.change_dir)
|nvim_tree.config.actions.change_dir|
• {expand_all}? (nvim_tree.config.actions.expand_all)
|nvim_tree.config.actions.expand_all|
• {file_popup}? (nvim_tree.config.actions.file_popup)
|nvim_tree.config.actions.file_popup|
• {open_file}? (nvim_tree.config.actions.open_file)
|nvim_tree.config.actions.open_file|
• {remove_file}? (nvim_tree.config.actions.remove_file)
|nvim_tree.config.actions.remove_file|
• {use_system_clipboard}? (boolean, default: true) Use the system
clipboard for copy/paste. Copied text will be
stored in registers + (system), otherwise,
it will be stored in 1 and "

nvim_tree.config.actions.change_dir
vim |current-directory| behaviour

Fields: ~
• {enable}? (boolean, default: true) Change the working
directory when changing directories in the tree
• {global}? (boolean, default: false) Use :cd instead
of :lcd when changing directories.
• {restrict_above_cwd}? (boolean, default: false) Restrict changing
to a directory above the global cwd.

nvim_tree.config.actions.expand_all
Configure |nvim_tree.api.tree.expand_all()| and
|nvim_tree.api.node.expand()|

Fields: ~
• {exclude}? (string[], default: {}) A list of
directories that should not be expanded
automatically e.g
{ ".git", "target", "build" }
• {max_folder_discovery}? (integer, default: 300) Limit the number
of folders being explored when expanding
every folder. Avoids hanging Nvim when
running this action on very large folders.

nvim_tree.config.actions.file_popup
{file_popup} floating window.

{open_win_config} is passed to |nvim_open_win()|, default: >lua
{
col = 1,
row = 1,
relative = "cursor",
border = "shadow",
style = "minimal",
}
<

You shouldn't define {width} and {height} values here. They will be
overridden to fit the file_popup content.

Fields: ~
• {open_win_config}? (vim.api.keyset.win_config) (default:
{ col = 1, row = 1, relative = "cursor", border = "shadow", style = "minimal", })

nvim_tree.config.actions.open_file
Opening files.

Fields: ~
• {eject}? (boolean, default: true) Prevent new opened file
from opening in the same window as the tree.
• {quit_on_open}? (boolean, default: false) Closes the explorer
when opening a file
• {resize_window}? (boolean, default: true) Resizes the tree when
opening a file
• {window_picker}? (nvim_tree.config.actions.open_file.window_picker)
|nvim_tree.config.actions.open_file.window_picker|

nvim_tree.config.actions.open_file.window_picker
A window picker will be shown when there are multiple windows available to
open a file. It will show a single character identifier in each window's
status line.

When it is not enabled the file will open in the window from which you
last opened the tree, obeying {exclude}

You may define a {picker} function that should return the window id that
will open the node, or nil if an invalid window is picked or user
cancelled the action. The picker may create a new window.

Fields: ~
• {chars}? (string, default:
"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890") Identifier
characters to use.
• {enable}? (boolean) (default: true)
• {exclude}? (nvim_tree.config.actions.open_file.window_picker.exclude)
|nvim_tree.config.actions.open_file.window_picker.exclude|
• {picker}? ("default"|(fun(): integer), default: "default")
Change the default window picker or define your own.

nvim_tree.config.actions.open_file.window_picker.exclude
Tables of buffer option names mapped to a list of option values. Windows
containing matching buffers will not be:
• available when using a window picker
• selected when not using a window picker

Fields: ~
• {buftype}? (string[]) (default:
{ "nofile", "terminal", "help", })
• {filetype}? (string[]) (default:
{ "notify", "lazy", "qf", "diff", "fugitive", "fugitiveblame", })

nvim_tree.config.actions.remove_file
Removing files.

Fields: ~
• {close_window}? (boolean, default: true) Close any window that
displays a file when removing that file from the
tree.

==============================================================================
Config: trash nvim-tree-config-trash

nvim_tree.config.trash
Files may be trashed via an external command that must be installed on
your system.
• linux: gio trash, from linux package glib2
• macOS: trash, from homebrew package trash
• windows: trash, requires trash-cli or similar

Fields: ~
• {cmd}? (string) (default: "gio trash" or "trash")

==============================================================================
Config: tab nvim-tree-config-tab

nvim_tree.config.tab

Fields: ~
• {sync}? (nvim_tree.config.tab.sync) |nvim_tree.config.tab.sync|

nvim_tree.config.tab.sync

Fields: ~
• {close}? (boolean, default: false) Closes the tree across all
tabpages when the tree is closed.
• {ignore}? (string[], default: {}) List of filetypes or buffer
names on new tab that will prevent open and close
• {open}? (boolean, default: false) Opens the tree automatically
when switching tabpage or opening a new tabpage if the tree
was previously open.

==============================================================================
Config: notify nvim-tree-config-notify

nvim_tree.config.notify
nvim-tree |vim.log.levels|
ERROR: hard errors e.g. failure to read from the file system.
WARN: non-fatal errors e.g. unable to system open a file.
INFO: information only e.g. file copy path confirmation.
DEBUG: information for troubleshooting, e.g. failures in some window
closing operations.

Fields: ~
• {absolute_path}? (boolean, default: true) Use absolute paths in
FS action notifications, otherwise item names.
• {threshold}? (vim.log.levels, default: vim.log.levels.INFO)
Specify minimum notification |vim.log.levels|

==============================================================================
Config: bookmarks nvim-tree-config-bookmarks

nvim_tree.config.bookmarks
Optionally {persist} bookmarks to a json file:
true use default: stdpath("data") .. "/nvim-tree-bookmarks.json"
false do not persist
string absolute path of your choice

Fields: ~
• {persist}? (boolean|string) (default: false)

==============================================================================
Config: help nvim-tree-config-help

nvim_tree.config.help
{sort_by} nvim_tree.config.help.sort_by

Sort help entries alphabetically by:
"key": map lhs
"desc": description

Fields: ~
• {sort_by}? (nvim_tree.config.help.sort_by) (default: "key")

==============================================================================
Config: ui nvim-tree-config-ui

nvim_tree.config.ui

Fields: ~
• {confirm}? (nvim_tree.config.ui.confirm)
|nvim_tree.config.ui.confirm|

nvim_tree.config.ui.confirm
Confirmation prompts.

Fields: ~
• {default_yes}? (boolean, default: false) If true the prompt
will be Y/n, otherwise y/N
• {remove}? (boolean, default: true) Prompt before removing.
• {trash}? (boolean, default: true) Prompt before trashing.

==============================================================================
Config: experimental nvim-tree-config-experimental

nvim_tree.config.experimental
Experimental features that may become default or optional functionality.

In the event of a problem please disable the experiment and raise an
issue.

Fields: ~
• {session_restore_nvim}? (boolean, default: false) Restore
nvim-tree buffers when restoring vim sessions
(requires 0.13+).

==============================================================================
Config: log nvim-tree-config-log

nvim_tree.config.log
Log to a file nvim-tree.log in |stdpath()| log, usually
${XDG_STATE_HOME}/nvim

Fields: ~
• {enable}? (boolean) (default: false)
• {truncate}? (boolean, default: false) Remove existing log file at
startup.
• {types}? (nvim_tree.config.log.types)
|nvim_tree.config.log.types|

nvim_tree.config.log.types
Specify which information to log.

Fields: ~
• {all}? (boolean, default: false) Everything.
• {config}? (boolean, default: false) Config and mappings, at
startup.
• {copy_paste}? (boolean, default: false) File copy and paste
actions.
• {dev}? (boolean, default: false) Used for local
development only. Not useful for users.
• {diagnostics}? (boolean, default: false) LSP and COC processing,
verbose.
• {git}? (boolean, default: false) Git processing, verbose.
• {profile}? (boolean, default: false) Timing of some
operations.
• {watcher}? (boolean, default: false)
|nvim_tree.config.filesystem_watchers| processing,
verbose.

==============================================================================
Config: Default nvim-tree-config-default

Following is the default configuration, see |nvim_tree.config| for details. >lua

---@type nvim_tree.config
local config = {
on_attach = "default",
hijack_cursor = false,
auto_reload_on_write = true,
disable_netrw = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
root_dirs = {},
prefer_startup_root = false,
sync_root_with_cwd = false,
reload_on_bufenter = false,
respect_buf_cwd = false,
select_prompts = false,
sort = {
sorter = "name",
folders_first = true,
files_first = false,
},
view = {
centralize_selection = false,
cursorline = true,
cursorlineopt = "both",
debounce_delay = 15,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
width = 30,
float = {
enable = false,
quit_on_focus_loss = true,
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
},
renderer = {
add_trailing = false,
group_empty = false,
full_name = false,
root_folder_label = ":~:s?$?/..?",
indent_width = 2,
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
hidden_display = "none",
symlink_destination = true,
decorators = { "Git", "Open", "Hidden", "Modified", "Bookmark", "Diagnostics", "Copied", "Cut", },
highlight_git = "none",
highlight_diagnostics = "none",
highlight_opened_files = "none",
highlight_modified = "none",
highlight_hidden = "none",
highlight_bookmarks = "none",
highlight_clipboard = "name",
indent_markers = {
enable = false,
inline_arrows = true,
icons = {
corner = "└",
edge = "│",
item = "│",
bottom = "─",
none = " ",
},
},
icons = {
web_devicons = {
file = {
enable = true,
color = true,
},
folder = {
enable = false,
color = true,
},
},
git_placement = "before",
modified_placement = "after",
hidden_placement = "after",
diagnostics_placement = "signcolumn",
bookmarks_placement = "signcolumn",
padding = {
icon = " ",
folder_arrow = " ",
},
symlink_arrow = " ➛ ",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
modified = true,
hidden = false,
diagnostics = true,
bookmarks = true,
},
glyphs = {
default = "",
symlink = "",
bookmark = "󰆤",
modified = "●",
hidden = "󰜌",
folder = {
arrow_closed = "",
arrow_open = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "✗",
staged = "✓",
unmerged = "",
renamed = "➜",
untracked = "★",
deleted = "",
ignored = "◌",
},
},
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_root = {
enable = false,
ignore_list = {},
},
exclude = false,
},
git = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = true,
disable_for_dirs = {},
timeout = 400,
cygwin_support = false,
},
diagnostics = {
enable = false,
show_on_dirs = false,
show_on_open_dirs = true,
debounce_delay = 500,
severity = {
min = vim.diagnostic.severity.HINT,
max = vim.diagnostic.severity.ERROR,
},
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
diagnostic_opts = false,
},
modified = {
enable = false,
show_on_dirs = true,
show_on_open_dirs = true,
},
filters = {
enable = true,
git_ignored = true,
dotfiles = false,
git_clean = false,
no_buffer = false,
no_bookmark = false,
custom = {},
exclude = {},
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
max_events = 0,
ignore_dirs = {
"/.ccls-cache",
"/build",
"/node_modules",
"/target",
"/.zig-cache",
},
whitelist_dirs = {},
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
expand_all = {
max_folder_discovery = 300,
exclude = {},
},
file_popup = {
open_win_config = {
col = 1,
row = 1,
relative = "cursor",
border = "shadow",
style = "minimal",
},
},
open_file = {
quit_on_open = false,
eject = true,
resize_window = true,
relative_path = true,
window_picker = {
enable = true,
picker = "default",
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
remove_file = {
close_window = true,
},
},
trash = {
cmd = "gio trash",
},
tab = {
sync = {
open = false,
close = false,
ignore = {},
},
},
notify = {
threshold = vim.log.levels.INFO,
absolute_path = true,
},
help = {
sort_by = "key",
},
ui = {
confirm = {
remove = true,
trash = true,
default_yes = false,
},
},
bookmarks = {
persist = false,
},
experimental = {
session_restore_nvim = false
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
},
}
<

==============================================================================
API nvim-tree-api

nvim-tree exposes a public API. This is non breaking, with additions made as
necessary.

Please do not require or use modules other than nvim-tree.api, as internal
modules will change without notice.

The API is separated into multiple modules:
• |nvim-tree-api-appearance|
• |nvim-tree-api-commands|
• |nvim-tree-api-events|
• |nvim-tree-api-filter|
• |nvim-tree-api-fs|
• |nvim-tree-api-git|
• |nvim-tree-api-map|
• |nvim-tree-api-marks|
• |nvim-tree-api-node|
• |nvim-tree-api-tree|

Modules are accessed via api.<module>.<function>

Example invocation of the reload function in the tree module: >lua

local api = require("nvim-tree.api")
api.tree.reload()
<

Generally, functions accepting a |nvim_tree.api.Node| as their first argument
will use the node under the cursor when that argument is not present or nil.
Some functions are mode-dependent: when invoked in visual mode they will
operate on all nodes in the visual selection instead of a single node. See
|nvim-tree-mappings-default| for which mappings support visual mode.

e.g. the following are functionally identical: >lua

api.node.open.edit(nil, { focus = true })

api.node.open.edit(api.tree.get_node_under_cursor(), { focus = true })
<


nvim_tree.api.Node
The Node class is a data class. Instances may be provided by API functions
for use as a:
• handle to pass back to API functions e.g. |nvim_tree.api.node.run.cmd()|
• reference in callbacks e.g. |nvim_tree.config.sort.Sorter| {sorter}

Please do not mutate the contents of any Node object.

Fields: ~
• {absolute_path} (string) of the file or directory
• {diag_severity}? (lsp.DiagnosticSeverity) diagnostic status
• {executable} (boolean) file is executable
• {fs_stat}? (uv.fs_stat.result) at time of last tree display,
see |uv.fs_stat()|
• {git_status} (nvim_tree.git.Status?) for files and directories
• {hidden} (boolean) node is not visible in the tree
• {name} (string) file or directory name
• {parent}? (nvim_tree.api.DirectoryNode) parent directory,
nil for root
• {type} ("file"|"directory"|"link") |uv.fs_stat()| {type}

nvim_tree.git.Status
Git statuses for a single node.

nvim_tree.git.XY: 2 character string, see man 1 git-status "Short
Format"

{dir} status is derived from its contents:
direct: inherited from child files
indirect: inherited from child directories

Fields: ~
• {dir}? (table<"direct"|"indirect", nvim_tree.git.XY[]>) direct
inclusive-or indirect status
• {file}? (nvim_tree.git.XY) status of a file node

==============================================================================
API: appearance nvim-tree-api-appearance

hi_test() nvim_tree.api.appearance.hi_test()
Open a new buffer displaying all nvim-tree highlight groups, their link
chain and concrete definition.

Similar to :so $VIMRUNTIME/syntax/hitest.vim as per |:highlight|


==============================================================================
API: commands nvim-tree-api-commands

get() nvim_tree.api.commands.get()
Retrieve all |nvim-tree-commands|

They have been created via |nvim_create_user_command()|, see also
|lua-guide-commands-create|

Return: ~
(table[])
• {command}
(fun(args: vim.api.keyset.create_user_command.command_args))
function that the command will execute
• {name} (string) name of the :NvimTree* command
• {opts} (vim.api.keyset.user_command) |command-attributes|


==============================================================================
API: config nvim-tree-api-config

default() nvim_tree.api.config.default()
Default nvim-tree config.

Return: ~
(nvim_tree.config) immutable deep clone

global() nvim_tree.api.config.global()
Global current nvim-tree config.

Return: ~
(nvim_tree.config) immutable deep clone

user() nvim_tree.api.config.user()
Reference to config passed to |nvim-tree-setup|

Return: ~
(nvim_tree.config?) nil when no config passed to setup


==============================================================================
API: events nvim-tree-api-events

subscribe({event_type}, {callback}) nvim_tree.api.events.subscribe()
Register a handler for an event, see |nvim-tree-events|.

Parameters: ~
• {event_type} (nvim_tree.api.events.Event) |nvim_tree_events_kind|
• {callback} (fun(payload: table?))


==============================================================================
API: filter nvim-tree-api-filter

custom.toggle() nvim_tree.api.filter.custom.toggle()
Toggle |nvim_tree.config.filters| {custom} filter.

dotfiles.toggle() nvim_tree.api.filter.dotfiles.toggle()
Toggle |nvim_tree.config.filters| {dotfiles} filter.

git.clean.toggle() nvim_tree.api.filter.git.clean.toggle()
Toggle |nvim_tree.config.filters| {git_clean} filter.

git.ignored.toggle() nvim_tree.api.filter.git.ignored.toggle()
Toggle |nvim_tree.config.filters| {git_ignored} filter.

live.clear() nvim_tree.api.filter.live.clear()
Exit live filter mode.

live.start() nvim_tree.api.filter.live.start()
Enter live filter mode. Opens an input window with |filetype|
NvimTreeFilter

no_bookmark.toggle() nvim_tree.api.filter.no_bookmark.toggle()
Toggle |nvim_tree.config.filters| {no_bookmark} filter.

no_buffer.toggle() nvim_tree.api.filter.no_buffer.toggle()
Toggle |nvim_tree.config.filters| {no_buffer} filter.

toggle() nvim_tree.api.filter.toggle()
Toggle |nvim_tree.config.filters| {enable} which applies to ALL filters.


==============================================================================
API: fs nvim-tree-api-fs

clear_clipboard() nvim_tree.api.fs.clear_clipboard()
Clear the nvim-tree clipboard.

copy.absolute_path({node}) nvim_tree.api.fs.copy.absolute_path()
Copy the absolute path to the system clipboard.

Parameters: ~
• {node} (nvim_tree.api.Node?)

copy.basename({node}) nvim_tree.api.fs.copy.basename()
Copy the name with extension omitted to the system clipboard.

Parameters: ~
• {node} (nvim_tree.api.Node?)

copy.filename({node}) nvim_tree.api.fs.copy.filename()
Copy the name to the system clipboard.

Parameters: ~
• {node} (nvim_tree.api.Node?)

copy.node({node}) nvim_tree.api.fs.copy.node()
Copy to the nvim-tree clipboard. In visual mode, copies all nodes in the
visual selection.

Parameters: ~
• {node} (nvim_tree.api.Node?)

copy.relative_path({node}) nvim_tree.api.fs.copy.relative_path()
Copy the path relative to the tree root to the system clipboard.

Parameters: ~
• {node} (nvim_tree.api.Node?)

create({node}) nvim_tree.api.fs.create()
Prompt to create a file or directory.

When {node} is a file it will be created in the parent directory.

Use a trailing "/" to create a directory e.g. "foo/"

Multiple directories/files may be created e.g. "foo/bar/baz"

Parameters: ~
• {node} (nvim_tree.api.Node?)

cut({node}) nvim_tree.api.fs.cut()
Cut to the nvim-tree clipboard. In visual mode, cuts all nodes in the
visual selection.

Parameters: ~
• {node} (nvim_tree.api.Node?)

move({node}) nvim_tree.api.fs.move()
Paste while cutting files from:
• current nvim-tree clipboard (if present)
• another nvim-tree instance via system clipboard

If {node} is a file it will pasted in the parent directory.

Parameters: ~
• {node} (nvim_tree.api.Node?)

paste({node}) nvim_tree.api.fs.paste()
Paste files from:
• current nvim-tree clipboard (if present)
• another nvim-tree instance via system clipboard

If {node} is a file it will pasted in the parent directory.

Parameters: ~
• {node} (nvim_tree.api.Node?)

print_clipboard() nvim_tree.api.fs.print_clipboard()
Print the contents of the nvim-tree clipboard.

remove({node}) nvim_tree.api.fs.remove()
Delete from the file system. In visual mode, deletes all nodes in the
visual selection with a single prompt.

Parameters: ~
• {node} (nvim_tree.api.Node?)

rename({node}) nvim_tree.api.fs.rename()
Prompt to rename by name.

Parameters: ~
• {node} (nvim_tree.api.Node?)

rename_basename({node}) nvim_tree.api.fs.rename_basename()
Prompt to rename by name with extension omitted.

Parameters: ~
• {node} (nvim_tree.api.Node?)

rename_full({node}) nvim_tree.api.fs.rename_full()
Prompt to rename by absolute path.

Parameters: ~
• {node} (nvim_tree.api.Node?)

rename_node({node}) nvim_tree.api.fs.rename_node()
Prompt to rename.

Parameters: ~
• {node} (nvim_tree.api.Node?)

rename_sub({node}) nvim_tree.api.fs.rename_sub()
Prompt to rename by absolute path with name omitted.

Parameters: ~
• {node} (nvim_tree.api.Node?)

trash({node}) nvim_tree.api.fs.trash()
Trash as per |nvim_tree.config.trash|. In visual mode, trashes all nodes
in the visual selection with a single prompt.

Parameters: ~
• {node} (nvim_tree.api.Node?)


==============================================================================
API: git nvim-tree-api-git

reload() nvim_tree.api.git.reload()
Update the git status of the entire tree.


==============================================================================
API: map nvim-tree-api-map

keymap.current() nvim_tree.api.map.keymap.current()
Retrieve all buffer local mappings for nvim-tree. These are the mappings
that are applied by |nvim_tree.config| {on_attach}, which may include
default mappings.

Return: ~
(vim.api.keyset.get_keymap[])

keymap.default() nvim_tree.api.map.keymap.default()
Retrieves the buffer local mappings for nvim-tree that are applied by
|nvim_tree.api.map.on_attach.default()|

Return: ~
(vim.api.keyset.get_keymap[])

on_attach.default({bufnr}) nvim_tree.api.map.on_attach.default()
Apply all |nvim-tree-mappings-default|. Call from your |nvim_tree.config|
{on_attach}.

Parameters: ~
• {bufnr} (integer) use the bufnr passed to {on_attach}


==============================================================================
API: marks nvim-tree-api-marks

bulk.delete() nvim_tree.api.marks.bulk.delete()
Delete all marked, prompting if |nvim_tree.config.ui.confirm| {remove}

bulk.move() nvim_tree.api.marks.bulk.move()
Prompts for a directory to move all marked nodes into.

bulk.trash() nvim_tree.api.marks.bulk.trash()
Delete all marked, prompting if |nvim_tree.config.ui.confirm| {trash}

clear() nvim_tree.api.marks.clear()
Clear all marks.

get({node}) nvim_tree.api.marks.get()
Return the node if it is marked.

Parameters: ~
• {node} (nvim_tree.api.Node?) file or directory

Return: ~
(nvim_tree.api.Node?)

list() nvim_tree.api.marks.list()
Retrieve all marked nodes.

Return: ~
(nvim_tree.api.Node[])

navigate.next() nvim_tree.api.marks.navigate.next()
Navigate to the next marked node, wraps.

navigate.prev() nvim_tree.api.marks.navigate.prev()
Navigate to the previous marked node, wraps.

navigate.select() nvim_tree.api.marks.navigate.select()
Prompts for selection of a marked node, sorted by absolute paths. A folder
will be focused, a file will be opened.

toggle({node}) nvim_tree.api.marks.toggle()
Toggle mark. In visual mode, toggles all nodes in the visual selection.

Parameters: ~
• {node} (nvim_tree.api.Node?) file or directory


==============================================================================
API: node nvim-tree-api-node

buffer.delete({node}, {opts}) nvim_tree.api.node.buffer.delete()
Deletes node's related buffer, if one exists. Executes |:bdelete| or
|:bdelete|!

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?)
• {force}? (boolean, default: false) Proceed even if the
buffer is modified.

buffer.wipe({node}, {opts}) nvim_tree.api.node.buffer.wipe()
Wipes node's related buffer, if one exists. Executes |:bwipe| or |:bwipe|!

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?) optional
• {force}? (boolean, default: false) Proceed even if the
buffer is modified.

collapse({node}, {opts}) nvim_tree.api.node.collapse()
Collapse the tree under a directory or a file's parent directory.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file
• {opts} (table?) optional
• {keep_buffers}? (boolean, default: false) Do not collapse
nodes with open buffers.

expand({node}, {opts}) nvim_tree.api.node.expand()
Recursively expand all nodes under a directory or a file's parent
directory.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file
• {opts} (table?) optional
• {expand_until}?
(fun(expansion_count: integer, node: Node): boolean)
Return true if node should be expanded.
expansion_count is the total number of folders expanded.

nvim_tree.api.node.navigate.diagnostics.next()
navigate.diagnostics.next({node})
Navigate to the next item showing diagnostic status.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.diagnostics.next_recursive()
navigate.diagnostics.next_recursive({node})
Navigate to the next item showing diagnostic status, recursively. Needs
|nvim_tree.config.diagnostics| {show_on_dirs}

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.diagnostics.prev()
navigate.diagnostics.prev({node})
Navigate to the previous item showing diagnostic status.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.diagnostics.prev_recursive()
navigate.diagnostics.prev_recursive({node})
Navigate to the previous item showing diagnostic status, recursively.
Needs |nvim_tree.config.diagnostics| {show_on_dirs}

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

navigate.git.next({node}) nvim_tree.api.node.navigate.git.next()
Navigate to the next item showing git status.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.git.next_recursive()
navigate.git.next_recursive({node})
Navigate to the next item showing git status, recursively. Needs
|nvim_tree.config.git| {show_on_dirs}

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.git.next_skip_gitignored()
navigate.git.next_skip_gitignored({node})
Navigate to the next item showing git status, skipping .gitignore

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

navigate.git.prev({node}) nvim_tree.api.node.navigate.git.prev()
Navigate to the previous item showing git status.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.git.prev_recursive()
navigate.git.prev_recursive({node})
Navigate to the previous item showing git status, recursively. Needs
|nvim_tree.config.git| {show_on_dirs}

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.git.prev_skip_gitignored()
navigate.git.prev_skip_gitignored({node})
Navigate to the previous item showing git status, skipping .gitignore

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.opened.next()
navigate.opened.next({node})
Navigate to the next |bufloaded()| file.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.opened.prev()
navigate.opened.prev({node})
Navigate to the previous |bufloaded()| file.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

navigate.parent({node}) nvim_tree.api.node.navigate.parent()
Navigate to the parent directory of the node.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.parent_close()
navigate.parent_close({node})
Navigate to the parent directory of the node, closing it.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.sibling.first()
navigate.sibling.first({node})
Navigate to the first node in the current node's folder.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.sibling.last()
navigate.sibling.last({node})
Navigate to the last node in the current node's folder.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.sibling.next()
navigate.sibling.next({node})
Navigate to the next node in the current node's folder, wraps.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.navigate.sibling.prev()
navigate.sibling.prev({node})
Navigate to the previous node in the current node's folder, wraps.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

open.drop({node}) nvim_tree.api.node.open.drop()
Switch to window with selected file if it exists, otherwise open, see
|:drop|

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

open.edit({node}, {opts}) nvim_tree.api.node.open.edit()
• file: open as per |nvim_tree.config.actions.open_file|
• directory: expand or collapse
• root: change directory up

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

open.horizontal({node}, {opts}) nvim_tree.api.node.open.horizontal()
Open file in a new horizontal split.

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

nvim_tree.api.node.open.horizontal_no_picker()
open.horizontal_no_picker({node}, {opts})
Open file in a new horizontal split without using the window picker.

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

nvim_tree.api.node.open.no_window_picker()
open.no_window_picker({node}, {opts})
Open file without using the window picker.

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

open.preview({node}, {opts}) nvim_tree.api.node.open.preview()
Open file with |'bufhidden'| set to delete.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

nvim_tree.api.node.open.preview_no_picker()
open.preview_no_picker({node}, {opts})
Open file with |'bufhidden'| set to delete without using the window
picker.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

nvim_tree.api.node.open.replace_tree_buffer()
open.replace_tree_buffer({node})
Open file in place: in the nvim-tree window.

Parameters: ~
• {node} (nvim_tree.api.Node?) file

open.tab({node}, {opts}) nvim_tree.api.node.open.tab()
Open file in a new tab.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

open.tab_drop({node}) nvim_tree.api.node.open.tab_drop()
Switch to tab containing window with selected file if it exists, otherwise
open in new tab, see |:drop|

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.node.open.toggle_group_empty()
open.toggle_group_empty({node})
Toggle |nvim_tree.config.renderer| {group_empty} for a directory. Needs
{group_empty} set.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory

open.vertical({node}, {opts}) nvim_tree.api.node.open.vertical()
Open file in a new vertical split.

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

nvim_tree.api.node.open.vertical_no_picker()
open.vertical_no_picker({node}, {opts})
Open file in a new vertical split without using the window picker.

Parameters: ~
• {node} (nvim_tree.api.Node?) file
• {opts} (table?) optional
• {focus}? (boolean, default: false) Keep focus in the tree
when opening the file.
• {quit_on_open}? (boolean, default: false) Quits the tree
when opening the file.

run.cmd({node}) nvim_tree.api.node.run.cmd()
Enter |cmdline| with the full path of the node and the cursor at the start
of the line.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

run.system({node}) nvim_tree.api.node.run.system()
Open with the system default handler: |vim.ui.open()|.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

show_info_popup({node}) nvim_tree.api.node.show_info_popup()
Open a popup window showing: fullpath, size, accessed, modified, created.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file


==============================================================================
API: tree nvim-tree-api-tree

change_root({path}) nvim_tree.api.tree.change_root()
Change the tree's root to a path.

Parameters: ~
• {path} (string?) absolute or relative path.

change_root_to_node({node}) nvim_tree.api.tree.change_root_to_node()
Change the tree's root to a folder node or the parent of a file node.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

nvim_tree.api.tree.change_root_to_parent()
change_root_to_parent({node})
Change the tree's root to the parent of a node.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory or file

close() nvim_tree.api.tree.close()
Close the tree, affecting all tabs as per |nvim_tree.config.tab.sync|
{close}

close_in_all_tabs() nvim_tree.api.tree.close_in_all_tabs()
Close the tree in all tabs.

close_in_this_tab() nvim_tree.api.tree.close_in_this_tab()
Close the tree in this tab only.

collapse_all({opts}) nvim_tree.api.tree.collapse_all()
Collapse the tree.

Parameters: ~
• {opts} (table?) optional
• {keep_buffers}? (boolean, default: false) Do not collapse
nodes with open buffers.

expand_all({node}, {opts}) nvim_tree.api.tree.expand_all()
Recursively expand all nodes under the tree root or specified folder.

Parameters: ~
• {node} (nvim_tree.api.Node?) directory
• {opts} (table?) optional
• {expand_until}?
(fun(expansion_count: integer, node: Node): boolean)
Return true if node should be expanded.
expansion_count is the total number of folders expanded.

find_file({opts}) nvim_tree.api.tree.find_file()
Find and focus a file or folder in the tree. Finds current buffer unless
otherwise specified.

Parameters: ~
• {opts} (table?) optional
• {buf}? (string|integer) Absolute/relative path OR bufnr
to find.
• {current_window}? (boolean, default: false) Requires
{open}: open in the current window.
• {focus}? (boolean, default: false) Focus the tree window.
• {open}? (boolean, default: false) Open the tree if
necessary.
• {update_root}? (boolean, default: false) Update root after
find, see |nvim_tree.config.update_focused_file|
{update_root}
• {winid}? (integer) Open the tree in the specified
|window-ID|, overrides {current_window}

focus() nvim_tree.api.tree.focus()
Focus the tree, opening it if necessary. Retained for compatibility, use
|nvim_tree.api.tree.open()| with no arguments instead.

get_node_under_cursor() nvim_tree.api.tree.get_node_under_cursor()
Retrieve the currently focused node.

Return: ~
(nvim_tree.api.Node?) nil if tree is not visible.

get_nodes() nvim_tree.api.tree.get_nodes()
Retrieve a hierarchical list of all the nodes.

Return: ~
(nvim_tree.api.Node[])

is_tree_buf({bufnr}) nvim_tree.api.tree.is_tree_buf()
Checks if a buffer is an nvim-tree.

Parameters: ~
• {bufnr} (integer?) 0 or nil for current buffer.

Return: ~
(boolean)

is_visible({opts}) nvim_tree.api.tree.is_visible()
Checks if nvim-tree is visible on the current, specified or any tab.

Parameters: ~
• {opts} (table?) optional
• {any_tabpage}? (boolean, default: false) Visible on any
tab.
• {tabpage}? (integer) |tab-ID| 0 or nil for current.

Return: ~
(boolean)

open({opts}) nvim_tree.api.tree.open()
Open the tree, focusing it if already open.

Parameters: ~
• {opts} (table?) optional
• {current_window}? (boolean, default: false) Open the tree
in the current window
• {find_file}? (boolean, default: false) Find the current
buffer.
• {path}? (string) Root directory for the tree
• {update_root}? (boolean, default: false) Update root
following {find_file}, see
|nvim_tree.config.update_focused_file| {update_root}
• {winid}? (integer) Open the tree in the specified
|window-ID|, overrides {current_window}

reload() nvim_tree.api.tree.reload()
Refresh the tree. Does nothing if closed.

resize({opts}) nvim_tree.api.tree.resize()
Resize the tree, persisting the new size. Resets to
|nvim_tree.config.view| {width} when no {opts} provided.

Only one option is supported, priority order: {width}, {absolute},
{relative}.

{absolute} and {relative} do nothing when |nvim_tree.config.view| {width}
is a function.

Parameters: ~
• {opts} (table?) optional
• {absolute}? (integer) Set the width.
• {relative}? (integer) Increase or decrease the width.
• {width}?
(nvim_tree.config.view.width.spec|nvim_tree.config.view.width)
New |nvim_tree.config.view| {width} value.

search_node() nvim_tree.api.tree.search_node()
Open the search dialogue.

toggle({opts}) nvim_tree.api.tree.toggle()
Open or close the tree.

Parameters: ~
• {opts} (table?) optional
• {current_window}? (boolean, default: false) Open the tree
in the current window
• {find_file}? (boolean, default: false) Find the current
buffer.
• {focus}? (boolean, default: true) Focus the tree when
opening.
• {path}? (string) Root directory for the tree
• {update_root}? (boolean, default: false) Update root
following {find_file}, see
|nvim_tree.config.update_focused_file| {update_root}
• {winid}? (integer) Open the tree in the specified
|window-ID|, overrides {current_window}

toggle_help() nvim_tree.api.tree.toggle_help()
Toggle help view.

winid({opts}) nvim_tree.api.tree.winid()
Retrieve the window of the open tree.

Parameters: ~
• {opts} (table?) optional
• {tabpage}? (integer) |tab-ID| 0 or nil for current.

Return: ~
(integer?) |window-ID|, nil if tree is not visible.


==============================================================================
Class: Class nvim-tree-class

nvim-tree uses the https://github.com/rxi/classic class framework adding safe
casts, instanceof mixin and conventional destructors.

The key differences between classic and ordinary Lua classes:
• The constructor |nvim_tree.Class:new()| is not responsible for allocation:
self is available when the constructor is called.
• Instances are constructed via the __call meta method: SomeClass(args)

Classes are conventionally named using camel case e.g. MyClass

Classes are created by extending another class: >lua

local Class = require("nvim-tree.classic")

---@class (exact) Fruit: nvim_tree.Class
---@field ...
local Fruit = Class:extend()

---@class (exact) Apple: Fruit
---@field ...
local Apple = Fruit:extend()
<

Implementing a constructor |nvim_tree.Class:new()| is optional, however it
must call the super constructor: >lua

---@protected
---@param args AppleArgs
function Apple:new(args)

---@type FruitArgs
local fruit_args = ...

Apple.super.new(self, fruit_args)
---
<

Create an instance of a class using the __call meta method that will invoke
the constructor: >lua

---@type AppleArgs
local args = ...

local an_apple = Apple(args)
-- above will call Apple:new(args)
<

In order to strongly type instantiation, the following pattern is used to type
the meta method __call with arguments and return: >lua

---@class (exact) Fruit: nvim_tree.Class
---@field ...
local Fruit = Class:extend()

---@class (exact) FruitArgs
---@field ...

---@class Fruit
---@overload fun(args: FruitArgs): Fruit

---@protected
---@param args FruitArgs
function Fruit:new(args)
<


nvim_tree.Class

Fields: ~
• {as} (fun(self: nvim_tree.Class, class: T): T?) See
|nvim_tree.Class:as()|.
• {destroy} (fun(self: nvim_tree.Class)) See
|nvim_tree.Class:destroy()|.
• {extend} (fun(self: nvim_tree.Class): [nvim_tree.Class]) See
|nvim_tree.Class:extend()|.
• {implement} (fun(self: nvim_tree.Class, mixin: nvim_tree.Class))
See |nvim_tree.Class:implement()|.
• {is} (fun(self: nvim_tree.Class, class: T): boolean) See
|nvim_tree.Class:is()|.
• {new} (fun(self: nvim_tree.Class, ...: any)) See
|nvim_tree.Class:new()|.
• {nop} (fun(self: nvim_tree.Class, ...: any)) See
|nvim_tree.Class:nop()|.
• {super} (nvim_tree.Class) Parent class, Class for base
classes.


Class:as({class}) nvim_tree.Class:as()
Type safe cast.

If instance |nvim_tree.Class:is()|, cast to {class} and return it,
otherwise nil.

Parameters: ~
• {class} (any) <T>

Return: ~
(any?) <T>

Class:destroy() nvim_tree.Class:destroy()
Conventional destructor, optional, must be called by the owner.

Parent destructor must be invoked using the form Parent.destroy(self)

Class:extend() nvim_tree.Class:extend()
Create a new class by extending another class.

Base classes extend Class

Return: ~
([nvim_tree.Class]) child class

Class:implement({mixin}) nvim_tree.Class:implement()
Add the methods and fields of a mixin using the form
SomeClass:implement(MixinClass)

If the mixin has fields, it must implement a constructor.

Parameters: ~
• {mixin} (nvim_tree.Class)

Class:is({class}) nvim_tree.Class:is()
Instance of.

Test whether an object is {class}, inherits {class} or implements mixin
{class}.

Parameters: ~
• {class} (any) <T>

Return: ~
(boolean)

Class:new({...}) nvim_tree.Class:new()
Constructor: self has been allocated and is available.

Super constructor must be called using the form
Child.super.new(self, parent_args)

Parameters: ~
• {...} (any) constructor arguments

Class:nop({...}) nvim_tree.Class:nop()
Utility method to bypass unused param warnings in abstract methods.

Parameters: ~
• {...} (any)


==============================================================================
Class: Decorator nvim-tree-class-decorator

Highlighting and icons for nodes are provided by Decorators, see
|nvim-tree-icons-highlighting| for an overview.

Decorators are rendered in |nvim_tree.config.renderer| {decorators} order of
additive precedence, with later decorators applying additively over earlier.

You may provide your own in addition to the builtin decorators, see
|nvim-tree-class-decorator-example|.

Decorators may:
• Add icons
• Set a highlight group name for the name or icons
• Override node icon

To register your decorator:
• Create a class that extends |nvim_tree.api.Decorator|
• Register it by adding the class to |nvim_tree.config.renderer| {decorators}

Your decorator will be constructed and executed each time the tree is
rendered.

Your class must:
• |nvim_tree.Class:extend()| the interface |nvim_tree.api.Decorator|
• Provide a no-arguments constructor |nvim_tree.Class:new()| that sets the
mandatory fields:
• {enabled}
• {highlight_range}
• {icon_placement}
• Call |nvim_tree.api.Decorator:define_sign()| in your constructor when
{icon_placement} is "signcolumn"

Your class may:
• Implement methods to provide decorations:
• |nvim_tree.api.Decorator:highlight_group()|
• |nvim_tree.api.Decorator:icon_node()|
• |nvim_tree.api.Decorator:icons()|


nvim_tree.api.Decorator
Extends: |nvim_tree.Class|

Decorator interface

Fields: ~
• {define_sign} (fun(self: nvim_tree.api.Decorator, icon: nvim_tree.api.highlighted_string?))
See |nvim_tree.api.Decorator:define_sign()|.
• {enabled} (boolean) Enable this decorator.
• {highlight_group} (fun(self: nvim_tree.api.Decorator, node: nvim_tree.api.Node): string?)
See |nvim_tree.api.Decorator:highlight_group()|.
• {highlight_range} (nvim_tree.config.renderer.highlight) What to
highlight: |nvim_tree.config.renderer.highlight|
• {icon_node} (fun(self: nvim_tree.api.Decorator, node: nvim_tree.api.Node): nvim_tree.api.highlighted_string?)
See |nvim_tree.api.Decorator:icon_node()|.
• {icon_placement} ("none"|nvim_tree.config.renderer.icons.placement)
Where to place the icons:
|nvim_tree.config.renderer.icons.placement|
• {icons} (fun(self: nvim_tree.api.Decorator, node: nvim_tree.api.Node): nvim_tree.api.highlighted_string[]?)
See |nvim_tree.api.Decorator:icons()|.

nvim_tree.api.highlighted_string
Text or glyphs with optional highlight group names to apply to it.

Fields: ~
• {hl} (string[]) Highlight group names to apply in order. Empty
table for no highlighting.
• {str} (string) One or many glyphs/characters.


Decorator:define_sign({icon}) nvim_tree.api.Decorator:define_sign()
Defines a sign for an icon. This is mandatory and necessary only when
{icon_placement} is "signcolumn"

This must be called during your constructor for all icons that you will
return from |nvim_tree.api.Decorator:icons()|

Parameters: ~
• {icon} (nvim_tree.api.highlighted_string?) does nothing if nil

nvim_tree.api.Decorator:highlight_group()
Decorator:highlight_group({node})
One highlight group that applies additively to the {node} name for
{highlight_range}.

Abstract, optional to implement.

Parameters: ~
• {node} (nvim_tree.api.Node)

Return: ~
(string?) highlight group name nil when no highlighting to apply
to the node

Decorator:icon_node({node}) nvim_tree.api.Decorator:icon_node()
Icon to override for the node.

Abstract, optional to implement.

Parameters: ~
• {node} (nvim_tree.api.Node)

Return: ~
(nvim_tree.api.highlighted_string?) icon nil for no override

Decorator:icons({node}) nvim_tree.api.Decorator:icons()
Icons to add to the node as per {icon_placement}

Abstract, optional to implement.

Parameters: ~
• {node} (nvim_tree.api.Node)

Return: ~
(nvim_tree.api.highlighted_string[]?) icons nil or empty table for
no icons. Only the first glyph of {str} is used when {icon_placement}
is "signcolumn"


==============================================================================
Class: Decorator example nvim-tree-class-decorator-example

A decorator class for nodes named "example", overriding all builtin decorators
except for Cut.
• Highlights node name with IncSearch
• Creates two icons "1" and "2" placed after the node name, highlighted
with DiffAdd and DiffText
• Replaces the node icon with "N", highlighted with Error

Create a class file ~/.config/nvim/lua/my-decorator.lua

Require and register it during |nvim-tree-setup|: >lua

local MyDecorator = require("my-decorator")

require("nvim-tree").setup({
renderer = {
decorators = {
"Git",
"Open",
"Hidden",
"Modified",
"Bookmark",
"Diagnostics",
"Copied",
MyDecorator,
"Cut",
},
},
})
<

Contents of my-decorator.lua: >lua

---@class (exact) MyDecorator: nvim_tree.api.Decorator
---@field private my_icon1 nvim_tree.api.highlighted_string
---@field private my_icon2 nvim_tree.api.highlighted_string
---@field private my_icon_node nvim_tree.api.highlighted_string
---@field private my_highlight_group string
local MyDecorator = require("nvim-tree.api").Decorator:extend()

---Mandatory constructor :new() will be called once per tree render, with no arguments.
function MyDecorator:new()
self.enabled = true
self.highlight_range = "name"
self.icon_placement = "after"

-- create your icons and highlights once, applied to every node
self.my_icon1 = { str = "1", hl = { "DiffAdd" } }
self.my_icon2 = { str = "2", hl = { "DiffText" } }
self.my_icon_node = { str = "N", hl = { "Error" } }
self.my_highlight_group = "IncSearch"

-- Define the icon signs only once
-- Only needed if you are using icon_placement = "signcolumn"
-- self:define_sign(self.my_icon1)
-- self:define_sign(self.my_icon2)
end

---Override node icon
---@param node nvim_tree.api.Node
---@return nvim_tree.api.highlighted_string? icon_node
function MyDecorator:icon_node(node)
if node.name == "example" then
return self.my_icon_node
else
return nil
end
end

---Return two icons for DecoratorIconPlacement "after"
---@param node nvim_tree.api.Node
---@return nvim_tree.api.highlighted_string[]? icons
function MyDecorator:icons(node)
if node.name == "example" then
return { self.my_icon1, self.my_icon2, }
else
return nil
end
end

---Exactly one highlight group for DecoratorHighlightRange "name"
---@param node nvim_tree.api.Node
---@return string? highlight_group
function MyDecorator:highlight_group(node)
if node.name == "example" then
return self.my_highlight_group
else
return nil
end
end

return MyDecorator
<

vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:

---

CHANGELOG

Changelog

1.18.0 (2026-07-01)


Features

* #1549: p will paste files from another nvim-tree instance, gp will cut/paste (#3336) (c760c92)


Bug Fixes

* #3312: correct cursor when full name shown, requires nvim 0.12.2+ (#3316) (d277467)
* #3324: deprecated BufModifiedSet event replaced by OptionSet event for Nvim 0.13+ (#3325) (f9bfc00)
* #3327: pass nvim_tree.api.node.open.Opts to all applicable nvim_tree.api.node.open function (#3329) (07f541f)
* full-name: lower zindex to get consistent cursor shape (d277467)

1.17.0 (2026-04-07)


Features

* #3292: add nvim_tree.config.filesystem_watchers.whitelist_dirs - strongly recommended for windows (#3298) (6eaf74c)
* #3310: minimum neovim version 0.10 (#3311) (7adc567)


Bug Fixes

* #3257: error when calling api.tree.find_file (#3304) (b548cfe)
* #3293: marks.bulk operations filter descendant nodes (#3294) (f37ebac)
* #3301: setup with empty config fails (#3303) (ec0efb0)
* system open native requires nvim 0.10 (#3309) (02ccbcd)


Performance Improvements

* #3231: decrease setup time: optimise setup and defer requires until tree open (#3308) (31503ad)
* #3257: remove setup for actions modules, full-name and explorer (#3299) (43a3bb4)
* #3257: remove setup for modules: buffers, diagnostics, git, help, keymap, lib, watcher (#3295) (3d385d3)
* #3257: remove setup for renderer, log, appearance (#3307) (3603f06)
* #3257: remove setup for view, extracting view-state (#3306) (4cbe795)

1.16.0 (2026-03-17)


Features

* #2994: add visual mode operations: copy, cut, delete, trash, toggle bookmark (#3268) (9197f3e)
* add default &lt;Del&gt; mapping for api.fs.remove (#3238) (ca8d82f)


Bug Fixes

* ##3288: restore single-item paste conflict prompts (#3289) (b3772ad)
* #3178: handle Windows paths in ignore_dirs and add .zig-cache to defaults (#3261) (5499299)
* #3187: prevent closing the last non-floating window when deleting files (#3282) (018a078)
* #3198: add filesystem_watchers.max_events to handle runaway filesystem events on PowerShell (#3232) (c07ce43)
* #3248: bookmark filter shows contents of marked directories (#3249) (5757bcf)
* #3251: pass git.timeout to all vim.system git calls (#3277) (e49b0d9)
* #3265: rename module api.health to api.appearance, to avoid :checkhealth detection (#3266) (1df1960)
#3267: renderer.icons._placement 'right_align' at the right hand edge, not the right of the name (#3270) (fa3c458)
* #3281: fix a bug when a view width of -1 is returned from a function (#3283) (c988e28)
* allow 0 (unlimited) filesystem_watchers.max_events which is the new default, except for windows at 1000 (#3279) (87594aa)
* increase filesystem_watchers.max_events from 100 to 1000 (#3263) (0f4d2d6)
* restore bookmark filter for marked directories (5757bcf)


Performance Improvements

* #3284: re-draw instead of refreshing the tree when a buffer is modified (#3285) (c8d8d51)

1.15.0 (2026-01-11)


Features

* #1826: add diagnostics.diagnostic_opts: vim.diagnostic.Opts will override diagnostics.severity and diagnostics.icons (#3190) (fefa335)
* #1851: add bookmarks.persist, default path: vim.fn.stdpath("data") .. "/nvim-tree-bookmarks.json", disabled by default (#3033) (c89215d)
* #3213: add view.width.lines_excluded option (776a5cd)
* #3213: add view.width.lines_excluded option (#3214) (776a5cd)
* add NvimTreeFilter filetype (64e2192)
* load command definitions at nvim startup (#3211) (1eda256)
* load command definitions in plugin directory (1eda256)
* set filter input filetype to NvimTreeFilter (#3207) (64e2192)
* use add_trailing also for symlink destination (81ede55)


Bug Fixes

* #3226: set &swapfile=false before setting tree buffer name, avoiding any potential collisions with a swapfile (#3227) (8298117)
* api.tree.change_root_to_node on a file now changes directory to parent as per documentation (#3228) (b8b44b6)
* correctly assign extmarks to lines when computing tree window width in grow when nvim-tree.view.width.lines_excluded contains "root" (e66994d)
* incorrect window width when right_align icons present (#3239) (e66994d)
* prevent NvimTree to be alternate buffer when tab open (#3205) (e397756)
* renderer.add_trailing applies to symlink destination (#3217) (81ede55)


Performance Improvements

* commands: defer module loading (#3210) (68c67ad)

1.14.0 (2025-08-12)


Features

* #2685: highlight git new tracked with NvimTreeGitFileNewHL (#3176) (0a52012)
* #2789: add optional function expand_until to api.tree.expand_all and api.node.expand (#3166) (1b876db)
* #2826: allow only one window with nvim-tree buffer per tab (#3174) (dd2364d)
* #3157: add view.cursorlineopt (#3158) (8eb5e0b)


Bug Fixes

* #3077: deleting a directory containing symlinked directory will delete the contents of the linked directory (#3168) (10db694)
* #3157: add view.cursorlineopt (8eb5e0b)
* #3172: live filter exception (#3173) (0a7fcdf)
* invalid window id for popup info window (#3147) (d54a187)
* picker: exclude full_name window id from the choice (#3165) (543ed3c)
* window picker ignore hidden window (#3145) (d87b41c)


Performance Improvements

* #3171: cache toplevel for untracked (#3185) (4425136)
* #3171: use vim.system() instead of vim.fn.system() to execute git toplevel (#3175) (9a05b9e)


Reverts

* #3180, #3177: invalid group or tabpage (#3181) (9b289ab)
* #3180, #3177: resolve live filter failures (#3183) (a4699c0)

1.13.0 (2025-06-14)


Features

* #3113: add renderer.icons.folder_arrow_padding (#3114) (ea5097a)
* #3132: add api.node.expand and api.node.collapse (#3133) (ae59561)


Bug Fixes

* "Invalid buffer id" on closing nvim-tree window (#3129) (25d16aa)
* #2746: background and right aligned icons in floating windows (#3128) (cbc3165)
* #3117: allow changing filename's casing (bd54d1d)
* #3117: windows: change file/dir case (#3135) (bd54d1d)
* #3122: remove redundant vim.validate (#3123) (e7d1b7d)
* #3124: fix icon padding for "right_align" placements, notably for dotfiles (#3125) (e4cd856)
* #3124: prevent empty icons_right_align response from breaking padding (e4cd856)
* #3134: setting one glyph to "" no longer disables others (#3136) (ebcaccd)
* #3143: actions.open_file.window_picker.exclude applies when not using window picker (#3144) (05d8172)
* fixes #3134 (ebcaccd)
* invalid buffer issue (25d16aa)

1.12.0 (2025-04-20)


Features

* add TreePreOpen event (#3105) (c24c047)


Bug Fixes

* #3101: when renderer.highlight_opened_files = "none" do not reload on BufUnload and BufReadPost (#3102) (5bea2b3)
* explicitly set border to "none" in full name float (#3094) (c3c1935)
* reliably dispatch exactly one TreeOpen and TreeClose events (#3107) (3a63717)

1.11.0 (2025-02-22)


Features

* #1984: add quit_on_open and focus opts to various api.node.open functions (#3054) (3281f33)
* #3037: add API node.buffer.delete, node.buffer.wipe (#3040) (fee1da8)


Bug Fixes

* #3045: wipe scratch buffers for full name and show info popups (#3050) (fca0b67)
* #3059: test for presence of new 0.11 API vim.hl.range (#3060) (70825f2)
* arithmetic on nil value error on first git project open (#3064) (8052310)
* stl and stlnc fillchars are hidden in window picker (b699143)
* window picker: hide fillchars: stl and stlnc (#3066) (b699143)

1.10.0 (2025-01-13)


Features

* api: add node.open.vertical_no_picker, node.open.horizontal_no_picker (#3031) (68fc4c2)


Bug Fixes

* #3015: dynamic width no longer truncates on right_align icons (#3022) (f7b76cd)
* #3018: error when focusing nvim-tree when in terminal mode (#3019) (db8d7ac)
* #3041: use vim.diagnostic.get for updating diagnostics (#3042) (aae0185)
* Can't re-enter normal mode from terminal mode (db8d7ac)
* hijack directory "BufEnter", "BufNewFile" events are nested (#3044) (39bc630)
* view.width functions may return strings (#3020) (6b4be1d)

1.9.0 (2024-12-07)


Features

* #2948: add custom decorators, :help nvim-tree-decorators (#2996) (7a4ff1a)


Bug Fixes

* #2954: more efficient LSP updates, increase diagnostics.debounce_delay from 50ms to 500ms (#3007) (1f3ffd6)
* #2990: Do not check if buffer is buflisted in diagnostics.update() (#2998) (28eac28)
* #3009: nvim &lt; 0.10 apply view options locally (#3010) (ca7c4c3)
* api: correct argument types in wrap_node and wrap_node_or_nil (#3006) (f7c65e1)

1.8.0 (2024-11-09)


Features

* #2819: add actions.open_file.relative_path, default enabled, following successful experiment (#2995) (2ee1c5e)
* #2938: add default filesystem_watchers.ignore_dirs = { "/.ccls-cache", "/build", "/node_modules", "/target", } (#2940) (010ae03)


Bug Fixes

* #2945: stack overflow on api.git.reload or fugitive event with watchers disabled (#2949) (5ad8762)
* #2947: root is never a dotfile, so that it doesn't propagate to children (#2958) (f5f6789)
* #2951: highlights incorrect following cancelled pick (#2952) (1c9553a)
* #2954: resolve occasional tree flashing on diagnostics, set tree buffer options in deterministic order (#2980) (82ab19e)
* #2961: windows: escape brackets and parentheses when opening file (#2962) (63c7ad9)
* #2969: After a rename, the node loses selection (#2974) (1403933)
* #2972: error on :colorscheme (#2973) (6e5a204)
* #2976: use vim.loop to preserve neovim 0.9 compatibility (#2977) (00dff48)
* #2978: grouped folder not showing closed icon (#2979) (120ba58)
* #2981: windows: root changed when navigating with LSP (#2982) (c22124b)
symlink file icons rendered when renderer.icons.show.file = false, folder.symlink was incorrectly rendered as folder.default|open (#2983) (2156bc0)

1.7.1 (2024-09-30)


Bug Fixes

* #2794: sshfs compatibility (#2922) (9650e73)
* #2928: nil explorer in parent move action (#2929) (0429f28)
* #2930: empty groups expanded on reload (#2935) (4520c03)
* invalid explorer on open (#2927) (59a8a6a)


Reverts

* #2794: sshfs compatibility (#2920) (8405ecf)

1.7.0 (2024-09-21)


Features

* #2430: use vim.ui.open as default system_open, for neovim 0.10+ (#2912) (03f737e)
* help closes on &lt;Esc&gt; and api.tree.toggle_help mappings (#2909) (b652dbd)


Bug Fixes

* #2862: windows path replaces backslashes with forward slashes (#2903) (45a93d9)
* #2906: resource leak on populate children (#2907) (a4dd5ad)
* #2917: fix root copy paths: Y, ge, gy, y (#2918) (b18ce8b)
* safely close last tree window (#2913) (bd48816)
* safely close tree window with pcall and debug logging (bd48816)

1.6.1 (2024-09-09)


Bug Fixes

* #2794: sshfs compatibility (#2893) (2d6e64d)
* #2868: windows: do not visit unenumerable directories such as Application Data (#2874) (2104786)
* #2878: nowrapscan prevents move from root (#2880) (4234095)
* #2879: remove unnecessary tree window width setting to prevent unnecessary :wincmd = (#2881) (d43ab67)

1.6.0 (2024-08-10)


Features

* #2225: add renderer.hidden_display to show a summary of hidden files below the tree (#2856) (e25eb7f)
#2349: add "right_align" option for renderer.icons._placement (#2839) (1d629a5)
#2349: add "right_align" option for renderer.icons._placement (#2846) (48d0e82)
* add renderer.highlight_hidden, renderer.icons.show.hidden and renderer.icons.hidden_placement for dotfile icons/highlights (#2840) (48a9290)


Bug Fixes

* #2859: make sure window still exists when restoring options (#2863) (466fbed)

1.5.0 (2024-07-11)


Features

* #2127: add experimental.actions.open_file.relative_path to open files with a relative path rather than absolute (#2805) (869c064)
* #2598: add api.tree.resize (#2811) (2ede0de)
* #2799: filesystem_watchers.ignore_dirs and git.disable_for_dirs may be functions (#2800) (8b2c5c6)
* #2799: filesystem_watchers.ignore_dirs and git.disable_for_dirs may be functions (8b2c5c6)


Bug Fixes

* #2813: macos: enable file renaming with changed capitalization (#2814) (abfd1d1)
* #2819: experimental.actions.open_file.relative_path issue following change directory (#2820) (12a9a99)

1.4.0 (2024-06-09)

Notice

* Neovim 0.9 is now the minimum supported version; please upgrade to neovim release version 0.9 or 0.10.

Reverts

* #2781: "refactor: replace deprecated use of vim.diagnostic.is_disabled()" (#2784) (517e4fb)


Miscellaneous Chores

* release 1.4.0 (1cac800)

1.3.3 (2024-05-14)


Bug Fixes

* nil access exception with git integration when changing branches (#2774) (340d3a9)

1.3.2 (2024-05-12)


Bug Fixes

* #2758: use nvim-webdevicons default file icon, not renderer.icons.glyphs.default, as per :help (#2759) (347e1eb)
* #2758: use nvim-webdevicons default for default files (347e1eb)
* #925: handle newlines in file names (#2754) (64f61e4)

1.3.1 (2024-04-25)


Bug Fixes

* #2535: TextYankPost event sends vim.v.event (#2734) (d8d3a15)
* #2733: escape trash path (#2735) (81eb8d5)

1.3.0 (2024-03-30)


Features

* add update_focused_file.exclude (#2673) (e20966a)


Bug Fixes

* #2658: change SpellCap groups to reduce confusion: ExecFile-&gt;Question, ImageFile->Question, SpecialFile->Title, Symlink->Underlined; add all other highlight groups to :NvimTreeHiTest (#2732) (0aca092)
* bookmark filter shows marked directory children (#2719) (2d97059)

1.2.0 (2024-03-24)


Features

* add api.tree.toggle_enable_filters (#2706) (f7c09bd)

1.1.1 (2024-03-15)


Bug Fixes

* #2395: marks.bulk.move defaults to directory at cursor (#2688) (cfea5bd)
* #2705: change NvimTreeWindowPicker cterm background from Cyan to more visible DarkBlue (#2708) (1fd9c98)
* bookmark filter should include parent directory (#2704) (76b9810)

1.1.0 (2024-03-14)


Features

* #2630: file renames can now create directories (#2657) (efafd73)
* add api.fs.copy.basename, default mapping ge (#2698) (8f2a50f)


Bug Fixes

* #2695: git toplevel guard against missing paths (#2696) (3c4267e)
* searchcount exception on invalid search regex (#2693) (041dbd1)

1.0.0 (2024-02-18)


Features

* #2654: filters.custom may be a function (#2655) (4a87b8b)


Miscellaneous Chores

* release 1.0.0 (#2678) (d16246a)

0.100.0 (2024-02-11)


Features

* #1389: api: recursive node navigation for git and diagnostics (#2525) (5d13cc8)
* #2415: add :NvimTreeHiTest (#2664) (b278fc2)
* #2415: colour and highlight overhaul, see :help nvim-tree-highlight-overhaul (#2455) (e9c5abe)
* add node.open.toggle_group_empty, default mapping L (#2647) (8cbb1db)


Bug Fixes

* #2415: disambiguate highlight groups, see :help nvim-tree-highlight-overhaul (#2639) (d9cb432)
* #2415: fix NvimTreeIndentMarker highlight group: FileIcon-&gt;FolderIcon (e9ac136)
* #2415: highlight help header and mappings (#2669) (39e6fef)
* #2415: nvim 0.8 highlight overhaul support, limited to only show highest highlight precedence (#2642) (f39f7b6)
* #2415: NvimTreeIndentMarker highlight group: FileIcon-&gt;FolderIcon (#2656) (e9ac136)
* #2624: open file from docked floating window (#2627) (f24afa2)
* #2632: occasional error stack when locating nvim-tree window (#2633) (48b1d86)
* #2637: show buffer modified icons and highlights (#2638) (7bdb220)
* #2643: correctly apply linked highlight groups in tree window (#2653) (fbee8a6)
* allow highlight overrides for DEFAULT_DEFS: NvimTreeFolderIcon, NvimTreeWindowPicker (#2636) (74525ac)
* bad column offset when using full_name (#2629) (75ff64e)
* passing nil as window handle in view.get_winnr (48b1d86)

0.99.0 (2024-01-01)


Features

* #1850: add "no bookmark" filter (#2571) (8f92e1e)
* add kind param to vim.ui.select function calls (#2602) (dc839a7)
* add option to skip gitignored files on git navigation (#2583) (50f30bc)


Bug Fixes

* #2519: Diagnostics Not Updated When Tree Not Visible (#2597) (96a783f)
* #2609: help toggle (#2611) (fac4900)
* hijack_cursor on update focused file and vim search (#2600) (02ae523)

---

CONTRIBUTING

Contributing to nvim-tree.lua

Thank you for contributing.

See wiki: Development for environment setup, tips and tools.

- Tools
- Quality
* lint
* style
* format-fix
* check
* format-check
- Diagnostics
- Backwards Compatibility
- :help Documentation
* Generated Content
* Updating And Generating
* Checking And Linting
- Windows
- Pull Request
* Subject
- AI Usage Policy: Highly Discouraged
* nvim-tree Is A Community Project
* The Burden Of Review Must Not Increase
* AI Generated PR Rules

Tools

Following are used during CI and strongly recommended during local development.

Language server: luals

Lint: luacheck

nvim-tree migrated from stylua to EmmyLuaCodeStyle ~2024/10. vim.lsp.buf.format() may be used as it is the default formatter for luals, using an embedded EmmyLuaCodeStyle

Formatting: EmmyLuaCodeStyle: CodeFormat executable

You can install them via you OS package manager e.g. pacman, brew or other via other package managers such as cargo or luarocks

Quality

The following quality checks are mandatory and are performed during CI. They run on the entire lua directory and return 1 on any failure.

You can run them all via make or make all

You can setup git hooks to run all checks by running scripts/setup-hooks.sh

lint

1. Runs luacheck quietly using .luacheck settings

sh
make lint

style

1. Runs lua language server codestyle-check only, using .luarc.json settings
1. Runs scripts/doc-comments.sh to normalise annotated documentation

sh
make style

format-fix

You can automatically fix most style issues using CodeFormat:

sh
make format-fix

check

1. Runs the checks that the LSP lua language server runs inside nvim using .luarc.json via scripts/luals-check.sh

sh
make check

Assumes $VIMRUNTIME is /usr/share/nvim/runtime. Adjust as necessary e.g.

sh
VIMRUNTIME="/my/path/to/runtime" make check

If lua-language-server is not available or --check doesn't function (e.g. Arch Linux 3.9.1-1) you can manually install it as per ci.yml using its current luals_version e.g.

sh
mkdir luals
curl -L "https://github.com/LuaLS/lua-language-server/releases/download/3.15.0/lua-language-server-3.15.0-linux-x64.tar.gz" | tar zx --directory luals

PATH="luals/bin:${PATH}" make check

format-check

This is run in CI. Commit or stage your changes and run:

sh
make format-check

- Re-runs make format-fix
- Checks that git diff is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.

Diagnostics

Diagnostics issues may not be suppressed. See luals documentation for details on how to structure the code and comments.

Suppressions are permitted only in the following cases:

- Backwards compatibility shims
- neovim API metadata incorrect, awaiting upstream fix
- classic class framework

Backwards Compatibility

Whenever new neovim API is introduced, please ensure that it is available in older versions. See :help deprecated.txt and $VIMRUNTIME/lua/vim/_meta/api.lua

See nvim-tree.setup for the oldest supported version of neovim. If the API is not availble in that version, a backwards compatibility shim must be used e.g.

lua
if vim.fn.has("nvim-0.11") == 1 and vim.hl and vim.hl.range then
vim.hl.range(0, ns_id, details.hl_group, { 0, col }, { 0, details.end_col, }, {})
else
vim.api.nvim_buf_add_highlight(0, ns_id, details.hl_group, 0, col, details.end_col) ---@diagnostic disable-line: deprecated
end

:help Documentation

Please update or add to doc/nvim-tree-lua.txt as needed.

Generated Content

doc/nvim-tree-lua.txt content starting at nvim-tree-config will be replaced with generated content. Do not manually edit that content.

API and Config

Help is generated for:
- nvim_tree.config classes from lua/nvim-tree/_meta/config/
- nvim_tree.api functions from lua/nvim-tree/_meta/api/

Please add or update documentation when you make changes, see :help dev-lua-doc for docstring format.

scripts/vimdoc_config.lua contains the manifest of help sources.

Config And Mappings

Help is updated for:
- Default keymap at keymap.on_attach_default
- Default config at --- config-default-start

Updating And Generating

Nvim sources are required. You will be prompted with instructions on fetching and using the sources.

See comments at the start of each script for complete details.

sh
make help-update

- scripts/help-defaults.sh
- Update config defaults nvim-tree-config-default
- Update default mappings:
- nvim-tree-mappings-default
- nvim-tree-quickstart-help

- scripts/vimdoc.sh doc
- Remove content starting at nvim-tree-config
- Generate config classes nvim-tree-config
- Generate API nvim-tree-api

Checking

This is run in CI. Commit or stage your changes and run:

sh
make help-check

- Re-runs make help-update
- Checks that git diff is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.

Windows

Please note that nvim-tree team members do not have access to nor expertise with Windows.

You will need to be an active participant during development and raise a PR to resolve any issues that may arise.

Please ensure that windows specific features and fixes are behind the appropriate feature flag, see wiki: OS Feature Flags

Pull Request

Please reference any issues in the description e.g. "resolves #1234", which will be closed upon merge.

Please check "allow edits by maintainers" to allow nvim-tree developers to make small changes such as documentation tweaks.

Do not enable or use any AI review tools (e.g. Copilot) on the Pull Request.

Subject

The merge commit message will be the subject of the PR.

A Conventional Commits subject will be validated by the Semantic Pull Request Subject CI job. Reference the issue to be used in the release notes e.g.

fix(#2395): marks.bulk.move defaults to directory at cursor

Available types:
* feat: A new feature
* fix: A bug fix
* docs: Documentation only changes
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* refactor: A code change that neither fixes a bug nor adds a feature
* perf: A code change that improves performance
* test: Adding missing tests or correcting existing tests
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
* chore: Other changes that don't modify src or test files
* revert: Reverts a previous commit

If in doubt, look at previous commits.

See also The Conventional Commits ultimate cheatsheet

AI Usage Policy: Highly Discouraged

nvim-tree Is A Community Project

nvim-tree is a work of passion, building a community of free thinking individuals who contribute highly polished, elegant and maintainable code. Community members range from novices to professionals and all are welcome. Teaching, encouraging and celebrating the growth of less experienced developers is of great importance.

AI generated code is discouraged as this doesn't match these nvim-tree values.

Human PR reviews will always be prioritised over AI generated PRs.

The Burden Of Review Must Not Increase

There must be a human in the loop at all times. The contributor is the author of and is fully accountable for AI generated contributions.

AI generated PRs have low, or even non-existent entry level. Human generated PRs require you to be motivated, do research, familiarise yourself with code, make effort to write the code and test it.

Low effort or unqualified code increases the burden of review and testing on maintainers, who are limited in time.

Contributors must:

- Read and review all generated code and documentation before raising a PR
- Fully understand all code and documentation
- Be able to answer any questions during review

AI Generated PR Rules

The PR description and comments must be written by the contributor, with no AI assistance beyond grammar or English translations.

The description must:

- Describe the solution design, justifying all decisions
- Clearly state which AI was used
- List which code and documentation was written by a human and which was written by AI
- Detail all testing performed

There must be far greater than usual number of detailed, explicit comments:

- File level: overview of the changes made
- Line level: 1-2 comments per function/method

Do not enable or use any AI review tools (e.g. Copilot) on the Pull Request.

---

README

A File Explorer For Neovim Written In Lua

[](https://github.com/nvim-tree/nvim-tree.lua/actions/workflows/ci.yml)

<img align="left" width="199" height="598" src="https://user-images.githubusercontent.com/1505378/232662694-8dc494e0-24da-497a-8541-29344293378c.png">
<img align="left" width="199" height="598" src="https://user-images.githubusercontent.com/1505378/232662698-2f321315-c67a-486b-85d8-8c391de52392.png">

Automatic updates

File type icons

Git integration

Diagnostics integration: LSP and COC

(Live) filtering

Rename, delete, create

Cut, copy, paste locally and between instances

Highly customisable

<br clear="left"/>
<br />

Take a look at the wiki for Showcases, Tips, Recipes and more.

Questions and general support: Discussions

- Requirements
- Installing
- Quick Start
* Setup
* Help
* Custom Mappings
* Highlight Groups
- Commands
- Roadmap
- API
- Contributing
- Screenshots
- Team

Requirements

Nvim >= 0.10. At least n - 0.1 stable Nvim compatibility is guaranteed. You may use a compat-nvim-0.X tag for earlier Nvim versions, however they will receive no updates or support.

nvim-web-devicons is optional and used to display file icons. It requires a patched font. Your terminal emulator must be configured to use that font, usually "Hack Nerd Font"

Installing

Please install via your preferred package manager. See Installation for some specific package manager instructions.

Major or minor versions may be specified via tags: v<MAJOR> e.g. v1 or v<MAJOR>.<MINOR> e.g. v1.23

Quick Start

Install the plugins via your package manager:
"nvim-tree/nvim-tree.lua"
"nvim-tree/nvim-web-devicons"

Disabling netrw is strongly advised, see :help nvim-tree-netrw

Setup

Setup the plugin in your init.lua.

See :help nvim-tree-setup and :help nvim-tree-config-default

lua
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

-- optionally enable 24-bit colour
vim.opt.termguicolors = true

-- empty setup using defaults
require("nvim-tree").setup()

-- OR setup with a config

---@type nvim_tree.config
local config = {
sort = {
sorter = "case_sensitive",
},
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
}
require("nvim-tree").setup(config)

Help

Open the tree: :NvimTreeOpen

Show the mappings: g?

Custom Mappings

:help nvim-tree-mappings-default are applied by default however you may customise via :help nvim_tree.config {on_attach} e.g.

lua
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"

local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end

-- default mappings
api.map.on_attach.default(bufnr)

-- custom mappings
vim.keymap.set("n", "<C-t>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
end

-- pass to setup along with your other config
require("nvim-tree").setup({
---
on_attach = my_on_attach,
---
})

Highlight Groups

See :help nvim-tree-highlight-groups

Run :NvimTreeHiTest to show all the highlights that nvim-tree uses.

They can be customised before or after setup is called and will be immediately
applied at runtime. e.g.

lua
vim.cmd([[
:hi NvimTreeExecFile guifg=#ffa0a0
:hi NvimTreeSpecialFile guifg=#ff80ff gui=underline
:hi NvimTreeSymlink guifg=Yellow gui=italic
:hi link NvimTreeImageFile Title
]])

Commands

See :help nvim-tree-commands

Some commands may be executed with a bang ! or take a path string argument.

All commands execute public API.

Some basic commands:

:NvimTreeFocus :help nvim_tree.api.tree.open()

lua
require("nvim-tree.api").tree.open()

:NvimTreeToggle :help nvim_tree.api.tree.toggle()

lua
require("nvim-tree.api").tree.toggle({
path = "<args>",
find_file = false,
update_root = false,
focus = true,
})

:NvimTreeFindFile :help nvim_tree.api.tree.find_file()

lua
require("nvim-tree.api").tree.find_file({
open = true,
update_root = "<bang>",
focus = true,
})

:NvimTreeCollapse :help nvim_tree.api.tree.collapse_all()

lua
require("nvim-tree.api").tree.collapse_all({
keep_buffers = false
})

Roadmap

nvim-tree is stable and new major features will not be added. The focus is on existing user experience.

Users are encouraged to add their own custom features via the public API.

Development is focused on:
- Bug fixes
- Performance
- Quality of Life improvements
- API / Events
- Enhancements to existing features
- Multi-instance capabilities

API

nvim-tree exposes a public API. This is non breaking, with additions made as necessary. See :help nvim-tree-api

See wiki Recipes and Tips for ideas and inspiration.

Please raise a feature request if the API is insufficient for your needs. Contributions are always welcome, see below.

You may also subscribe to events that nvim-tree will dispatch in a variety of situations, see :help nvim-tree-events

Contributing

PRs are always welcome. See CONTRIBUTING and wiki: Development to get started.

See bug and PR Please issues if you are looking for some work to get you started.

Screenshots

See Showcases wiki page for examples of user's configurations with sources.

Please add your own!

Team

* @alex-courtis Arch Linux
* @gegoune macOS
* @Akmadan23 Linux
* [@dependabot[bot]](https://github.com/apps/dependabot) Ubuntu Linux

---