# aghussb/nvim architecture

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

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

## Overview

This project is a custom Neovim configuration written in Lua, designed to streamline and enhance the text editing and git workflow within Neovim. Its purpose is to provide an easily customizable and modular set of configurations and plugins that improve the editing experience, using lazy.nvim as its plugin manager. The project is structured around clear separation of concerns: base configurations, language-specific setups, and a categorization of plugins for different functionalities (such as coding enhancements, Git integrations, user interface improvements, and utility tools).

##### Main Components Identification
- Neovim Core & Entry Point:
- "init.lua" is the entry point which bootstraps the entire configuration.
- Configuration Modules:
- lua/config – Contains submodules for various configuration aspects:
- autocmds.lua: Handles automatic command setup.
- keymaps.lua: Defines custom keybindings.
- options.lua: Sets up editor options.
- lazy.lua: Configures lazy.nvim for plugin management.
- Language Configurations:
- lua/langs – Contains language-specific configuration files (e.g., javascript.lua, lua.lua, typescript.lua, prisma.lua) along with a helper/example file.
- Plugin Configurations:
- lua/plugins – Organizes plugins into directories based on functionality:
- plugins/coding: Plugins for autopairs, surround, and visual multi-cursors.
- plugins/git: Plugins for diff views, Git signs, and lazygit integration.
- plugins/lsp: LSP and completion related setups.
- plugins/ui: UI enhancements such as statusline, bufferline, file explorer (neo-tree), and themes.
- plugins/utils: Utility plugins like telescope, conform (formatting), todo-comments, which-key, etc.

##### Relationships and Data Flow
- The "init.lua" acts as the central starting point which loads the configuration files from the "lua" directory.
- From the Neovim core (init.lua) to configuration modules.
- From the configuration modules to language-specific configurations.
- From the configuration module (lazy.lua) to each plugin category.
- Additionally, external dependencies (like fd, rg, lazygit, etc.) required by some plugins can be indicated as external services or tools outside the main Neovim configuration.

##### Architectural Patterns and Design Principles
- Modularity: The project is separated into clearly defined folders (config, langs, plugins) that allow easy customization of each aspect of the Neovim experience.
- Separation of Concerns: Each category of configuration (keymaps, options, plugin setup) is isolated, making the entire setup easily maintainable and extensible.
- Lazy Loading: With lazy.nvim managing the plugins, the architecture embraces lazy initialization to improve performance.
- Extensibility: Using external plugins and adding new language configurations (as shown in the README examples) makes it straightforward to extend the functionality.

##### Relevant Technologies and Frameworks
- Neovim as the core editor.
- Lua for configuration scripting.
- lazy.nvim for plugin management.
- Various Neovim plugins for LSP, completion (nvim-cmp and its extensions), Git integration, UI components, and additional utilities such as Telescope and Conform for formatting.
- External tools like fd, rg, and lazygit are integrated to support plugin functionality.

##### Final Touches
- Notes or callouts if necessary to explain design decisions, such as lazy loading or the purpose of each grouped configuration module.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TD
    %% Neovim Core
    I1["init.lua"]:::core

    %% Configuration Modules
    subgraph "Configuration Modules"
        C1["autocmds.lua"]:::config
        C2["keymaps.lua"]:::config
        C3["options.lua"]:::config
        C4["lazy.nvim Setup"]:::config
    end

    %% Language Configurations
    subgraph "Language Configurations"
        L1["Helper & Init"]:::lang
        L2["Javascript"]:::lang
        L3["Lua"]:::lang
        L4["Prisma"]:::lang
        L5["Typescript"]:::lang
    end

    %% Plugin Configurations
    subgraph "Plugin Configurations"
        subgraph "Coding Enhancements"
            P1["Autopairs"]:::plugin
            P2["Surround"]:::plugin
            P3["Visual Multi-cursors"]:::plugin
        end
        subgraph "Git Integrations"
            P4["Diff View"]:::plugin
            P5["Git Signs"]:::plugin
            P6["Lazygit Integration"]:::plugin
        end
        subgraph "LSP & Completion"
            P7["CMP"]:::plugin
            P8["LSP Configurations"]:::plugin
            P9["Treesitter"]:::plugin
        end
        subgraph "UI Enhancements"
            P10["Alpha"]:::plugin
            P11["Bufferline"]:::plugin
            P12["Highlight Chunk"]:::plugin
            P13["Statusline (lualine)"]:::plugin
            P14["File Explorer (neo-tree)"]:::plugin
            P15["Theme (onedark)"]:::plugin
        end
        subgraph "Utility Tools"
            P16["Formatting (conform)"]:::plugin
            P17["Fidget"]:::plugin
            P18["Telescope"]:::plugin
            P19["TODO Comments"]:::plugin
            P20["Which-key"]:::plugin
        end
    end

    %% External Tools
    subgraph "External Tools"
        E1["fd"]:::external
        E2["rg"]:::external
        E3["lazygit"]:::external
    end

    %% Connections
    I1 -->|"bootstraps"| C4
    C4 -->|"loads"| L1
    C4 -->|"imports"| P1
    P6 -->|"requires"| E3
    P18 -->|"utilizes"| E1
    P18 -->|"utilizes"| E2

    %% Style Classes
    classDef core fill:#FFCC99,stroke:#333,stroke-width:2px;
    classDef config fill:#99CCFF,stroke:#333,stroke-width:2px;
    classDef lang fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef plugin fill:#FFCCFF,stroke:#333,stroke-width:2px;
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:2px;

    %% Click Events
    click I1 "https://github.com/aghussb/nvim/blob/main/init.lua"
    click C1 "https://github.com/aghussb/nvim/blob/main/lua/config/autocmds.lua"
    click C2 "https://github.com/aghussb/nvim/blob/main/lua/config/keymaps.lua"
    click C3 "https://github.com/aghussb/nvim/blob/main/lua/config/options.lua"
    click C4 "https://github.com/aghussb/nvim/blob/main/lua/config/lazy.lua"
    click L1 "https://github.com/aghussb/nvim/blob/main/lua/langs/_lang.example"
    click L2 "https://github.com/aghussb/nvim/blob/main/lua/langs/javascript.lua"
    click L3 "https://github.com/aghussb/nvim/blob/main/lua/langs/lua.lua"
    click L4 "https://github.com/aghussb/nvim/blob/main/lua/langs/prisma.lua"
    click L5 "https://github.com/aghussb/nvim/blob/main/lua/langs/typescript.lua"
    click P1 "https://github.com/aghussb/nvim/blob/main/lua/plugins/coding/autopairs.lua"
    click P2 "https://github.com/aghussb/nvim/blob/main/lua/plugins/coding/surround.lua"
    click P3 "https://github.com/aghussb/nvim/blob/main/lua/plugins/coding/visual-multi.lua"
    click P4 "https://github.com/aghussb/nvim/blob/main/lua/plugins/git/diffview.lua"
    click P5 "https://github.com/aghussb/nvim/blob/main/lua/plugins/git/gitsigns.lua"
    click P6 "https://github.com/aghussb/nvim/blob/main/lua/plugins/git/lazygit.lua"
    click P7 "https://github.com/aghussb/nvim/blob/main/lua/plugins/lsp/cmp.lua"
    click P8 "https://github.com/aghussb/nvim/blob/main/lua/plugins/lsp/config.lua"
    click P9 "https://github.com/aghussb/nvim/blob/main/lua/plugins/lsp/treesitter.lua"
    click P10 "https://github.com/aghussb/nvim/blob/main/lua/plugins/ui/alpha.lua"
    click P11 "https://github.com/aghussb/nvim/blob/main/lua/plugins/ui/bufferline.lua"
    click P12 "https://github.com/aghussb/nvim/blob/main/lua/plugins/ui/hlchunk.lua"
    click P13 "https://github.com/aghussb/nvim/blob/main/lua/plugins/ui/lualine.lua"
    click P14 "https://github.com/aghussb/nvim/blob/main/lua/plugins/ui/neo-tree.lua"
    click P15 "https://github.com/aghussb/nvim/blob/main/lua/plugins/ui/onedark.lua"
    click P16 "https://github.com/aghussb/nvim/blob/main/lua/plugins/utils/conform.lua"
    click P17 "https://github.com/aghussb/nvim/blob/main/lua/plugins/utils/fidget.lua"
    click P18 "https://github.com/aghussb/nvim/blob/main/lua/plugins/utils/telescope.lua"
    click P19 "https://github.com/aghussb/nvim/blob/main/lua/plugins/utils/todo-comments.lua"
    click P20 "https://github.com/aghussb/nvim/blob/main/lua/plugins/utils/which-key.lua"
```
