# preservim/nerdtree architecture

> Architecture diagram of the GitHub repository preservim/nerdtree, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/preservim/nerdtree
- Repository: https://github.com/preservim/nerdtree

## Overview

NERDTree is a Vim file-system explorer. The documented workflow starts with a user opening it using `:NERDTree`, browsing directory hierarchies, and opening files; it also supports basic file operations and extension through its API. The tree identifies likely implementation modules, but no source excerpts were provided, so internal calls and dispatch paths cannot be verified and are left unconnected.

Main entry points: [`plugin/NERD_tree.vim`](https://github.com/preservim/nerdtree/blob/master/plugin/NERD_tree.vim) (Plugin Commands), [`lib/nerdtree/tree_dir_node.vim`](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/tree_dir_node.vim) (Tree Nodes), [`lib/nerdtree/opener.vim`](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/opener.vim) (File Opening), [`nerdtree_plugin/fs_menu.vim`](https://github.com/preservim/nerdtree/blob/master/nerdtree_plugin/fs_menu.vim) (File Operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Vim Entry"]
  node_plugin_entry["Plugin Commands<br/>[NERD_tree.vim]"]
end

subgraph group_explorer["Tree Explorer"]
  node_tree_creator["Tree Creation<br/>[creator.vim]"]
  node_tree_model["Tree Nodes<br/>[tree_dir_node.vim]"]
  node_file_nodes["File Nodes<br/>[tree_file_node.vim]"]
  node_tree_ui["Tree Display<br/>[ui.vim]"]
  node_tree_glue["Vim UI Glue<br/>[ui_glue.vim]"]
end

subgraph group_actions["File Actions"]
  node_file_opening["File Opening<br/>[opener.vim]"]
  node_filesystem_menu["File Operations<br/>[fs_menu.vim]"]
end

subgraph group_extensions["Extensions"]
  node_plugin_api["Extension API<br/>[NERDTree.txt]"]
end

node_user(("Vim User"))

node_user -->|"opens explorer"| node_plugin_entry
node_user -.->|"browses hierarchy"| node_tree_model
node_user -.->|"opens files"| node_file_opening
node_user -.->|"performs operations"| node_filesystem_menu
node_user -->|"extends mappings"| node_plugin_api

click node_plugin_entry "https://github.com/preservim/nerdtree/blob/master/plugin/NERD_tree.vim"
click node_tree_creator "https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/creator.vim"
click node_tree_model "https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/tree_dir_node.vim"
click node_file_nodes "https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/tree_file_node.vim"
click node_tree_ui "https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/ui.vim"
click node_tree_glue "https://github.com/preservim/nerdtree/blob/master/autoload/nerdtree/ui_glue.vim"
click node_file_opening "https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/opener.vim"
click node_filesystem_menu "https://github.com/preservim/nerdtree/blob/master/nerdtree_plugin/fs_menu.vim"
click node_plugin_api "https://github.com/preservim/nerdtree/blob/master/doc/NERDTree.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_plugin_entry,node_user toneBlue
class node_tree_creator,node_tree_model,node_file_nodes,node_tree_ui,node_tree_glue toneAmber
class node_file_opening,node_filesystem_menu toneMint
class node_plugin_api toneRose
```

## Components

### Vim Entry

- [Plugin Commands](https://github.com/preservim/nerdtree/blob/master/plugin/NERD_tree.vim): `plugin/NERD_tree.vim`

### Tree Explorer

- [Tree Creation](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/creator.vim): `lib/nerdtree/creator.vim`
- [Tree Nodes](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/tree_dir_node.vim): `lib/nerdtree/tree_dir_node.vim`
- [File Nodes](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/tree_file_node.vim): `lib/nerdtree/tree_file_node.vim`
- [Tree Display](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/ui.vim): `lib/nerdtree/ui.vim`
- [Vim UI Glue](https://github.com/preservim/nerdtree/blob/master/autoload/nerdtree/ui_glue.vim): `autoload/nerdtree/ui_glue.vim`

### File Actions

- [File Opening](https://github.com/preservim/nerdtree/blob/master/lib/nerdtree/opener.vim): `lib/nerdtree/opener.vim`
- [File Operations](https://github.com/preservim/nerdtree/blob/master/nerdtree_plugin/fs_menu.vim): `nerdtree_plugin/fs_menu.vim`

### Extensions

- [Extension API](https://github.com/preservim/nerdtree/blob/master/doc/NERDTree.txt): `doc/NERDTree.txt`

### Other components

- **Vim User**

## Connections

- Vim User → Plugin Commands: opens explorer (evidence: `README.markdown`)
- Vim User → Tree Nodes: browses hierarchy
- Vim User → File Opening: opens files
- Vim User → File Operations: performs operations
- Vim User → Extension API: extends mappings (evidence: `README.markdown`)
