# etiennecollin/nvim architecture

> Architecture diagram of the GitHub repository etiennecollin/nvim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/etiennecollin/nvim
- Repository: https://github.com/etiennecollin/nvim

## Overview

##### Main Components
- Central Initialization: At the top-level you have the init.lua file which serves as the entry point.
- Core Configuration: Inside lua/etiennecollin/core, files like init.lua, options.lua, and remaps (basic and plugin specific) are responsible for setting up the editor’s base settings and key mappings.
- Autocommands: The lua/etiennecollin/autocmds.lua module handles events/scripts that run automatically.
- Plugin Management: The lazy.lua file and the expanded lua/etiennecollin/plugins directory indicate that plugin management is done in a modular way. Within the plugins directory there are several sub-categories such as:
- Colorschemes (defining appearance),
- Core plugins (essential tools for functionality),
- Extra plugins (enhancements, e.g., cellular-automaton),
- Language-specific plugins (for better language support: markdown preview, typst, vimtex, etc.),
- LSP-related plugins (managing language servers, debugging tools like dap, linting, etc.).
- Utility Components: Other files include lua/etiennecollin/utils.lua for helper functions and the separate snippets and syntax directories that likely extend editor capabilities.

##### Relationships and Data Flow
- From core, branch out to the autocmds module that configures event handling.
- Separately illustrate the plugin subsystem:
– Start with a “Plugin Management” node (possibly represented by lazy.lua).
– From there, branch out to different plugin groups: Core, Colorscheme, Extra, Language-Specific, and LSP.
– Within the LSP branch, include a sub-node for server configurations and individualized plugin setups (e.g., dap, lspconfig, mason, etc.).
- Also, show the connection from plugins/resources that rely on external binaries and utilities (as mentioned in the README such as pkg-config, fzf, ripgrep, imagemagick, etc.).

##### Architectural Patterns
- Modularization: The strict separation into core configuration, plugins by category, and utilities shows a clear separation of concerns.
- Dependency Injection / Lazy Loading: With the presence of a lazy.lua file and potentially plugin-specific lazy loading, indicate that components load only when needed.
- Extensibility: The project structure, with its split-out plugin categories and directories for snippets and syntax, emphasizes an extensible design where new functionality can be added with minimal coupling.

##### Detail
- Subdirectories and their purpose are clearly represented.

## Diagram (Mermaid)

```mermaid
graph TD
    A["init.lua (Entry Point)"]:::init
    B["Core Configuration (Options, Remaps)"]:::config
    C["Autocommands"]:::config
    D["Plugin Manager (lazy.lua)"]:::plugin
    E1["Colorscheme Plugins"]:::plugin
    E2["Core Plugins"]:::plugin
    E3["Extra Plugins"]:::plugin
    E4["Language-Specific Plugins"]:::plugin
    E5["LSP Plugins and Server Configurations"]:::plugin
    F["Utilities & External Dependencies"]:::util
    G1["Snippets Extensions"]:::ext
    G2["Syntax Extensions"]:::ext

    A -->|"initializes"| B
    B -->|"configures"| C
    A -->|"loads"| D
    D -->|"manages"| E1
    D -->|"manages"| E2
    D -->|"manages"| E3
    D -->|"manages"| E4
    D -->|"manages"| E5
    B -->|"leverages"| F
    E2 -->|"requires"| F
    E5 -->|"requires"| F
    A -->|"includes"| G1
    A -->|"includes"| G2

    classDef init fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef config fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef plugin fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef util fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef ext fill:#FFB6C1,stroke:#333,stroke-width:2px;

    click A "https://github.com/etiennecollin/nvim/blob/main/init.lua"
    click B "https://github.com/etiennecollin/nvim/tree/main/lua/etiennecollin/core"
    click C "https://github.com/etiennecollin/nvim/blob/main/lua/etiennecollin/autocmds.lua"
    click D "https://github.com/etiennecollin/nvim/blob/main/lua/etiennecollin/lazy.lua"
    click E1 "https://github.com/etiennecollin/nvim/tree/main/lua/etiennecollin/plugins/colorscheme"
    click E2 "https://github.com/etiennecollin/nvim/tree/main/lua/etiennecollin/plugins/core"
    click E3 "https://github.com/etiennecollin/nvim/tree/main/lua/etiennecollin/plugins/extra"
    click E4 "https://github.com/etiennecollin/nvim/tree/main/lua/etiennecollin/plugins/language-specific"
    click E5 "https://github.com/etiennecollin/nvim/tree/main/lua/etiennecollin/plugins/lsp"
    click F "https://github.com/etiennecollin/nvim/blob/main/lua/etiennecollin/utils.lua"
    click G1 "https://github.com/etiennecollin/nvim/tree/main/snippets"
    click G2 "https://github.com/etiennecollin/nvim/tree/main/syntax"
```
