A file explorer tree for neovim written in lua
Go to file
Alexander Courtis 3fc8de198c
chore: migrate to classic (#2991)
* add classic, migrating nodes classes

* add mixins to classic

* typechecked optargs constructors for nodes

* typechecked optargs constructors for watcher and event

* luacheck

* typechecked optargs constructors for GitRunner

* typechecked optargs constructors for Sorter

* typechecked optargs constructors for decorators, WIP

* typechecked optargs constructors for decorators, WIP

* typechecked optargs constructors for decorators

* remove class

* replace enums with named maps

* Renderer and Builder use classic, tidy opts

* LiveFilter uses classic, tidy opts

* Filter uses classic, tidy opts

* add FilterTypes named map

* move toggles into filters

* Marks uses classic, tidy opts

* Sorter uses classic, tidy opts

* Clipboard uses classic, tidy opts

* use supers for node methods

* HighlightDisplay uses classic

* protected :new

* Watcher tidy

* Revert "use supers for node methods"

This reverts commit 9fc7a866ec.

* Watcher tidy

* format

* format

* Filters private methods

* format

* Sorter type safety

* Sorter type safety

* Sorter type safety

* Sorter type safety

* Sorter type safety

* Sorter type safety

* tidy Runner

* tidy hi-test name
2024-11-09 14:14:04 +11:00
.github chore: enable incomplete-signature-doc, format nvt-min.lua, assorted formatting tidies (#2967) 2024-10-25 14:25:30 +11:00
.hooks ci: lua language server and Makefile (#2546) 2024-01-06 13:18:52 +11:00
doc doc: remove outdated warning from actions.change_dir.global 2024-10-27 10:48:17 +11:00
lua chore: migrate to classic (#2991) 2024-11-09 14:14:04 +11:00
scripts chore: luals runtime.version only set during check, to prevent lua version ambuguity at dev time (#2975) 2024-10-28 11:57:53 +11:00
.editorconfig chore: style: align_continuous_similar_call_args (#2937) 2024-09-30 15:34:01 +10:00
.gitignore feat: add renderer.highlight_hidden, renderer.icons.show.hidden and renderer.icons.hidden_placement for dotfile icons/highlights (#2840) 2024-07-21 16:00:34 +10:00
.luacheckrc chore: enable incomplete-signature-doc, format nvt-min.lua, assorted formatting tidies (#2967) 2024-10-25 14:25:30 +11:00
.luarc.json chore: luals runtime.version only set during check, to prevent lua version ambuguity at dev time (#2975) 2024-10-28 11:57:53 +11:00
.release-please-manifest.json chore(master): release nvim-tree 1.7.1 (#2921) 2024-09-30 11:26:35 +10:00
CHANGELOG.md chore(master): release nvim-tree 1.7.1 (#2921) 2024-09-30 11:26:35 +10:00
CONTRIBUTING.md doc: add windows specifics to CONTRIBUTING 2024-10-27 10:32:41 +11:00
LICENSE renaming: lua-tree -> nvim-tree 2020-12-27 19:14:34 +01:00
Makefile chore(#2931): stylua -> EmmyLuaCodeStyle (#2932) 2024-09-29 14:05:52 +10:00
README.md chore(#2787): minimum nvim version 0.9, replace 0.10 deprecated, enable deprecated warnings (#2788) 2024-06-09 12:24:35 +10:00
release-please-config.json chore: first release (#2588) 2023-12-11 01:36:12 +01:00

A File Explorer For Neovim Written In Lua

CI

Automatic updates

File type icons

Git integration

Diagnostics integration: LSP and COC

(Live) filtering

Cut, copy, paste, rename, delete, create

Highly customisable



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

Questions and general support: Discussions

Requirements

neovim >=0.9.0

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"

Install

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

nvim-tree/nvim-tree.lua

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

nvim-tree/nvim-web-devicons optional, for file icons

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

Quick Start

Setup

Setup the plugin in your init.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 some options
require("nvim-tree").setup({
  sort = {
    sorter = "case_sensitive",
  },
  view = {
    width = 30,
  },
  renderer = {
    group_empty = true,
  },
  filters = {
    dotfiles = true,
  },
})

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 |nvim-tree.on_attach| e.g.

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.config.mappings.default_on_attach(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 options
require("nvim-tree").setup {
  ---
  on_attach = my_on_attach,
  ---
}

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.

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

See :help nvim-tree-highlight for details.

Commands

See :help nvim-tree-commands

Basic commands:

:NvimTreeToggle Open or close the tree. Takes an optional path argument.

:NvimTreeFocus Open the tree if it is closed, and then focus on the tree.

:NvimTreeFindFile Move the cursor in the tree for the current buffer, opening folders if needed.

:NvimTreeCollapse Collapses the nvim-tree recursively.

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

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.

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 wiki 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