# tycharlie99/my-neovim architecture

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

- Interactive diagram: https://gitdiagram.com/tycharlie99/my-neovim
- Repository: https://github.com/tycharlie99/my-neovim

## Overview

##### Project type and purpose
- This is *not* a web service or microservice–based system. It’s a *Neovim configuration* written in Lua, structured around a plugin manager (Lazy.nvim), modular config files, plugin‐specific config modules, and one custom plugin (`perforce.nvim`).
- Purpose: Bootstraps Neovim v0.11+, sets up core editor options, keymaps, and loads/configures a suite of community plugins (LSP, treesitter, telescope, etc.), plus a custom Perforce integration.

##### File structure
- Top‐level:
- `init.lua` – entry point for Neovim.
- `lua/config/` – core editor settings (options, keymaps, lazy setup).
- `lua/plugins/` – individual plugin config modules.
- `lua/perforce.nvim/` – custom plugin source.
- `lazy-lock.json` & `.luarc.json` – lockfile & Lua language server config.
- Configuration files set options and register plugins via Lazy.nvim.
- Each file under `lua/plugins/*.lua` configures one plugin.
- The custom plugin lives in its own subtree and is registered by name.

##### README for additional insights
- External dependencies: ripgrep for Telescope live_grep; mason.nvim for LSP installs; win32yank for Windows clipboard.

a. Main components
1. Neovim Core (nvim binary + runtime API)
2. Entry‐point: init.lua
3. Plugin Manager: Lazy.nvim (configured in `lua/config/lazy.lua`)
4. Core config modules under `lua/config/`
– keymaps, options, lazy setup
5. Plugin config modules under `lua/plugins/`
– e.g. nvim-cmp, lualine, treesitter, telescope, copilot-chat, etc.
6. Custom Plugin: perforce.nvim
7. External Tools
– ripgrep
– mason.nvim (and its installed LSP servers)
– win32yank (on Windows/WSL)
b. Relationships & data flow
– Neovim core loads `init.lua` on startup.
– `init.lua` sources `lua/config/lazy.lua`, which initializes Lazy.nvim.
– Lazy.nvim reads plugin list (from `lua/plugins/init.lua`), installs & loads each plugin.
– Each plugin module configures its respective plugin via Neovim’s Lua API.
– Custom plugin `perforce.nvim` is loaded alongside community plugins.
– Plugins like telescope call out to ripgrep; LSP plugins communicate with language servers installed by mason.
– Keymaps dispatch user input into plugin commands or Neovim API calls.
c. Architectural patterns & principles
– Modular configuration: split by concern (core vs plugins).
– Dependency injection via Lazy.nvim (declarative plugin listing).
– Plugin isolation: each plugin config is self-contained.
d. Key technologies/frameworks
– Neovim v0.11+ and Lua API
– Lazy.nvim (plugin manager)
– nvim-lspconfig, mason.nvim (LSP management)
– telescope.nvim + ripgrep
– nvim-treesitter
– Custom Lua plugin: perforce.nvim

##### Essential details
- That `lua/config/lazy.lua` is the pivot point for plugin loading.
- Flow for LSP requests (Neovim → nvim-lspconfig → mason-installed server → language server).
- External commands (ripgrep invoked by telescope).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Input Layer
    subgraph "User Input Layer"
        Keystrokes[[User Keystrokes]]:::input
    end

    %% Core Config Layer
    subgraph "Core Config Layer"
        NeovimCore[(Neovim Core)]:::core
        Init["init.lua"]:::entry
        Options["options.lua"]:::config
        Keymaps["keymaps.lua"]:::config
        LazyConfig["lazy.lua"]:::config
    end

    %% Plugin Management Layer
    subgraph "Plugin Management Layer"
        Lazy["Lazy.nvim"]:::manager
        PluginList["plugins/init.lua"]:::pluginloader
    end

    %% Plugin Layer
    subgraph "Plugin Layer"
        Copilot["copilot-chat.lua"]:::plugin
        Lualine["lualine.lua"]:::plugin
        NullLs["null-ls.lua"]:::plugin
        Cmp["nvim-cmp.lua"]:::plugin
        LSPConfig["nvim-lspconfig.lua"]:::plugin
        TreeNvim["nvim-tree.lua"]:::plugin
        Treesitter["nvim-treesitter.lua"]:::plugin
        Telescope["telescope.lua"]:::plugin
        Signify["vim-signify.lua"]:::plugin
        WhichKey["which-key.lua"]:::plugin
        Perforce[/perforce.nvim/]:::custom
        PerforceEntry["perforce.lua"]:::custom
    end

    %% External Services Layer
    subgraph "External Services Layer"
        Ripgrep[(ripgrep)]:::external
        Mason[(mason.nvim & LSP servers)]:::external
        LSPServer[(Language Servers)]:::external
        WinYank[(win32yank)]:::external
    end

    %% Connections
    Keystrokes --> NeovimCore
    NeovimCore --> Init
    Init --> Options
    Init --> Keymaps
    Init --> LazyConfig

    LazyConfig --> Lazy
    Lazy --> PluginList

    PluginList --> Copilot
    PluginList --> Lualine
    PluginList --> NullLs
    PluginList --> Cmp
    PluginList --> LSPConfig
    PluginList --> TreeNvim
    PluginList --> Treesitter
    PluginList --> Telescope
    PluginList --> Signify
    PluginList --> WhichKey
    PluginList --> Perforce

    Telescope --> Ripgrep
    LSPConfig --> Mason
    Mason --> LSPServer
    NeovimCore --> WinYank

    %% Click Events
    click Init "https://github.com/tycharlie99/my-neovim/blob/main/init.lua"
    click LazyConfig "https://github.com/tycharlie99/my-neovim/blob/main/lua/config/lazy.lua"
    click Options "https://github.com/tycharlie99/my-neovim/blob/main/lua/config/options.lua"
    click Keymaps "https://github.com/tycharlie99/my-neovim/blob/main/lua/config/keymaps.lua"
    click PluginList "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/init.lua"
    click Copilot "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/copilot-chat.lua"
    click Lualine "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/lualine.lua"
    click NullLs "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/null-ls.lua"
    click Cmp "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/nvim-cmp.lua"
    click LSPConfig "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/nvim-lspconfig.lua"
    click TreeNvim "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/nvim-tree.lua"
    click Treesitter "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/nvim-treesitter.lua"
    click Telescope "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/telescope.lua"
    click Signify "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/vim-signify.lua"
    click WhichKey "https://github.com/tycharlie99/my-neovim/blob/main/lua/plugins/which-key.lua"
    click Perforce "https://github.com/tycharlie99/my-neovim/blob/main/lua/perforce.nvim"
    click PerforceEntry "https://github.com/tycharlie99/my-neovim/blob/main/lua/perforce.nvim/lua/perforce.lua"

    %% Styles
    classDef input fill:#f9f,stroke:#333,stroke-width:1px
    classDef core fill:#bbf,stroke:#333,stroke-width:1px
    classDef entry fill:#bfb,stroke:#333,stroke-width:1px
    classDef config fill:#dfd,stroke:#333,stroke-width:1px
    classDef manager fill:#ffd,stroke:#333,stroke-width:1px
    classDef pluginloader fill:#fcc,stroke:#333,stroke-width:1px
    classDef plugin fill:#fcf,stroke:#333,stroke-width:1px
    classDef custom fill:#ff9,stroke:#333,stroke-width:1px,shape:hexagon
    classDef external fill:#ccc,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
