# isturiz/nvim architecture

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

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

## Overview

##### Project type and purpose
- This is a personalized Neovim configuration repository (a dotfiles-like project) written in Lua.
- Its purpose is to bootstrap and manage Neovim with a set of plugins, language servers, key mappings, and editor options to streamline the developer’s workflow.

##### File structure
- Top-level files:
- init.lua – the Neovim entry point
- lazy-lock.json – lockfile for the lazy.nvim plugin manager
- after/ftplugin & after/plugin – filetype-specific and general Vimscript/Lua autocommands loaded “after” startup
- lsp/ – per-language LSP configuration modules
- lua/config/ – core Neovim settings (options, keymaps, plugin manager init)
- lua/plugins/ – individual plugin configuration files
- Plugin manager: lazy.nvim is initialized in lua/config/lazy_init.lua.
- LSP installation: handled by the Mason plugin (installed via lazy.nvim) and configured via modules in lsp/.

##### README for additional insights
- Describes requirements (Node.js for certain plugins, Mason).
- Describes plugin installation (`:Lazy install`) and update (`:Lazy update`).
- Conventions: lua/config for core setup, lua/plugins for per-plugin overrides.

##### Components
a. Main components
- Neovim Core – built-in runtime
- Plugin Manager – lazy.nvim
- Configuration Layer
– Core settings (options.lua)
– Keymaps (keymaps.lua)
– Plugin definitions (lazy_init.lua)
- Plugin Modules – individual Lua files under lua/plugins/
- Filetype Plugins – after/ftplugin/*.lua
- LSP Configuration – lsp/*.lua
- External Services
– LSP servers (rust_analyzer, pylsp, lua_ls, etc.)
– Node.js for plugin tooling
– Mason (manages LSP/server installations)
b. Relationships & interactions
1. Neovim Core → loads init.lua
2. init.lua → calls lazy_init → lazy.nvim
3. lazy.nvim → installs & loads plugin modules from lua/plugins/
4. Core settings & keymaps injected at startup
5. on FileType event → after/ftplugin/*.lua apply filetype-specific settings
6. Mason plugin → ensures LSP servers are present
7. Plugin ‘nvim-lspconfig’ → loads lsp/*.lua modules → spawns LSP servers
8. Plugins such as autopairs, gitsigns, copilot → attach to buffer events
c. Architectural patterns & design principles
- Modular configuration: each plugin or feature in its own Lua file
- Lazy-loading: plugins only start when needed (via lazy.nvim)
- Separation of concerns: core options/keymaps vs. plugin logic vs. filetype overrides
d. Key technologies
- Neovim (Lua API)
- lazy.nvim (plugin manager)
- Mason (LSP installer)
- nvim-lspconfig (LSP client)
- Various community plugins (telescope, gitsigns, treesitter, etc.)

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Neovim Core"
    Core["Neovim Core\n(init.lua)"]:::core
  end
  click Core "https://github.com/isturiz/nvim/blob/main/init.lua"

  subgraph "Configuration Layer"
    opts["options.lua"]:::core
    keys["keymaps.lua"]:::core
    cfginit["init.lua"]:::core
  end
  click opts "https://github.com/isturiz/nvim/blob/main/lua/config/options.lua"
  click keys "https://github.com/isturiz/nvim/blob/main/lua/config/keymaps.lua"
  click cfginit "https://github.com/isturiz/nvim/blob/main/lua/config/init.lua"

  Core -->|"loads init.lua"| cfginit
  cfginit -->|"initializes"| PM

  subgraph "Plugin Manager"
    PM["lazy.nvim\n(lazy_init.lua)"]:::core
  end
  click PM "https://github.com/isturiz/nvim/blob/main/lua/config/lazy_init.lua"

  PM -->|"installs & loads"| Plugins

  subgraph "Plugin Modules"
    auto["autopairs"]:::plugin
    cop["copilot"]:::plugin
    git["gitsigns"]:::plugin
    tel["telescope"]:::plugin
    tree["treesitter"]:::plugin
    masonP["mason"]:::plugin
    otherP["..."]:::plugin
  end
  click auto "https://github.com/isturiz/nvim/blob/main/lua/plugins/autopairs.lua"
  click cop "https://github.com/isturiz/nvim/blob/main/lua/plugins/copilot.lua"
  click git "https://github.com/isturiz/nvim/blob/main/lua/plugins/gitsigns.lua"
  click tel "https://github.com/isturiz/nvim/blob/main/lua/plugins/telescope.lua"
  click tree "https://github.com/isturiz/nvim/blob/main/lua/plugins/tree-sitter.lua"
  click masonP "https://github.com/isturiz/nvim/blob/main/lua/plugins/mason.lua"
  click otherP "https://github.com/isturiz/nvim/tree/main/lua/plugins/"

  subgraph "FileType Event"
    FT["FileType"]:::event
  end

  subgraph "After ftplugin"
    astro["astro.lua"]:::plugin
    fish["fish.lua"]:::plugin
    luaft["lua.lua"]:::plugin
    xmlft["xml.lua"]:::plugin
  end
  click astro "https://github.com/isturiz/nvim/blob/main/after/ftplugin/astro.lua"
  click fish "https://github.com/isturiz/nvim/blob/main/after/ftplugin/fish.lua"
  click luaft "https://github.com/isturiz/nvim/blob/main/after/ftplugin/lua.lua"
  click xmlft "https://github.com/isturiz/nvim/blob/main/after/ftplugin/xml.lua"

  subgraph "General After Hooks"
    lspHook["lsp.lua"]:::plugin
  end
  click lspHook "https://github.com/isturiz/nvim/blob/main/after/plugin/lsp.lua"

  subgraph "LSP Configuration"
    lem["lemminx"]:::lsp
    luals["lua_ls"]:::lsp
    pylsp["pylsp"]:::lsp
    rust["rust_analyzer"]:::lsp
    tail["tailwind"]:::lsp
    tsls["ts_ls"]:::lsp
  end
  click lem "https://github.com/isturiz/nvim/blob/main/lsp/lemminx.lua"
  click luals "https://github.com/isturiz/nvim/blob/main/lsp/lua_ls.lua"
  click pylsp "https://github.com/isturiz/nvim/blob/main/lsp/pylsp.lua"
  click rust "https://github.com/isturiz/nvim/blob/main/lsp/rust_analyzer.lua"
  click tail "https://github.com/isturiz/nvim/blob/main/lsp/tailwind.lua"
  click tsls "https://github.com/isturiz/nvim/blob/main/lsp/ts_ls.lua"

  subgraph "External Dependencies"
    Node["Node.js"]:::external
    MasonSvc["Mason"]:::external
    Servers["LSP Servers"]:::external
  end

  Plugins -->|"on FileType"| FT
  FT -->|"loads ftplugin"| astro & fish & luaft & xmlft
  Plugins -->|"autocommands"| lspHook
  lspHook -->|"loads modules"| lem & luals & pylsp & rust & tail & tsls
  masonP -->|"manages"| Servers
  masonP -->|"via"| MasonSvc
  lem & luals & pylsp & rust & tail & tsls -->|"spawn"| Servers

  classDef core fill:#cce5ff,stroke:#00529B,color:#000
  classDef plugin fill:#d4edda,stroke:#155724,color:#000
  classDef lsp fill:#fff3cd,stroke:#856404,color:#000
  classDef external fill:#e2e3e5,stroke:#6c757d,color:#000
  classDef event fill:#f8d7da,stroke:#721c24,color:#000
```
