# danirod/vimrc architecture

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

- Interactive diagram: https://gitdiagram.com/danirod/vimrc
- Repository: https://github.com/danirod/vimrc

## Overview

##### Project Type and Purpose
- Type: A Vim configuration distribution (“dotfiles”) repo.
- Purpose:
– Provide a customized Vim setup via a single vimrc file.
– Organize and version Vim plugins using native “pack” directories and Git submodules.
– Automate plugin fetching/updating via GNUmakefile.
– Enforce a GDPR-compliant GitHub fork policy via a GitHub Actions workflow.

##### File Structure
Top-level:
- vimrc           ← main Vim configuration
- GNUmakefile     ← fetch/update plugin packs
- .gitmodules     ← lists all plugin submodules
- .github/        ← CI workflow that auto-closes PRs
- pack/           ← native Vim “packages” directory
- plugin/         ← runtime plugin loader scripts
- ftplugin/       ← filetype-specific settings (eruby, markdown, ruby, svelte)
- undodir/        ← persistent-undo storage
pack/ subdirectories (each a Git submodule):
– coding/         (editorconfig-vim, vim-polyglot)
– lsp/            (ale, asyncomplete, vim-lsp, etc.)
– shell/          (fzf, nerdtree)

##### Key Insights from README
- Plugins are “regular packs” tracked as Git submodules.
- GNUmakefile orchestrates submodule clone/update.
- Repo is mirrored; PRs closed automatically due to GDPR policy.

##### Main Components
a. Core Config Layer
– vimrc
– ftplugin/*
b. Plugin Management Layer
– pack/* (coding, lsp, shell) ← each a submodule
– .gitmodules
– GNUmakefile
c. Runtime Loader Layer
– plugin/* .vim scripts that initialize each plugin
d. Persistent Data
– undodir/ for undo files
e. CI & Repo Orchestration
– .github/workflows/closepr.yml
– External Services: git.danirod.es (primary remote), GitHub mirror

##### Relationships & Data Flows
- At “git clone”: submodules are defined in .gitmodules → GNUmakefile runs → git submodule update
- At Vim startup: vimrc → loads ftplugin and plugin scripts → activates all pack/* plugins via native package loading
- CI: on PR → GitHub Actions workflow closes PRs automatically
- Backup: push/pull to primary remote (git.danirod.es), read-only mirror on GitHub

##### Architectural Patterns & Design Principles
- Modular plugin management using Vim’s native “pack” system (no external plugin manager).
- Separation of concerns:
– pack/ holds raw plugin code (submodules)
– plugin/ holds glue scripts (configuration/enabling)
– ftplugin/ holds filetype-specific settings
- Infrastructure as code: GNUmakefile automates plugin sync; GitHub Actions enforces policy.
- Self-contained: no external dependencies beyond Git and Vim.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top-level events
    UserCLI["User / CLI"]:::external
    VimStartup["Vim Startup"]:::external
    PROpened["PR Opened"]:::external
    PushPull["Push / Pull"]:::external

    %% Core Config Layer
    subgraph "Core Config Layer"
        vimrc["vimrc"]:::configCol
        eruby["ftplugin/eruby.vim"]:::configCol
        markdown["ftplugin/markdown.vim"]:::configCol
        rubyft["ftplugin/ruby.vim"]:::configCol
        svelte["ftplugin/svelte.vim"]:::configCol
    end

    %% Plugin Management Layer
    subgraph "Plugin Management Layer"
        gitmodules[".gitmodules"]:::buildCol
        makefile["GNUmakefile"]:::buildCol
        packcoding["pack/coding"]:::pluginCol
        packlsp["pack/lsp"]:::pluginCol
        packshell["pack/shell"]:::pluginCol
    end

    %% Runtime Loader Layer
    subgraph "Runtime Loader Layer"
        edconfig["plugin/coding/editorconfig-vim.vim"]:::configCol
        polyglot["plugin/coding/vim-polyglot.vim"]:::configCol
        aleLoader["plugin/lsp/ale.vim"]:::configCol
        vimlspLoader["plugin/lsp/vim-lsp.vim"]:::configCol
        fzfLoader["plugin/shell/fzf.vim"]:::configCol
        nerdtreeLoader["plugin/shell/nerdtree.vim"]:::configCol
    end

    %% Persistent Data
    subgraph "Persistent Data"
        undodir["undodir/"]:::dataCol
    end

    %% CI & Repo Orchestration
    subgraph "CI & Repo Orchestration"
        workflows[".github/workflows/closepr.yml"]:::ciCol
    end

    %% External Remotes
    subgraph "External Remotes"
        primary["git.danirod.es"]:::remoteCol
        mirror["GitHub Mirror"]:::remoteCol
    end

    %% Build and Plugin Flows
    UserCLI -->|"clone repo"| gitmodules
    gitmodules -->|"defines submodules"| makefile
    makefile -->|"update submodules"| packcoding
    makefile --> packlsp
    makefile --> packshell

    VimStartup -->|"loads"| vimrc
    vimrc -->|"sources"| eruby
    vimrc --> markdown
    vimrc --> rubyft
    vimrc --> svelte
    vimrc -->|"sources"| edconfig
    vimrc --> polyglot
    vimrc --> aleLoader
    vimrc --> vimlspLoader
    vimrc --> fzfLoader
    vimrc --> nerdtreeLoader
    edconfig -->|"activates"| packcoding
    polyglot --> packcoding
    aleLoader --> packlsp
    vimlspLoader --> packlsp
    fzfLoader --> packshell
    nerdtreeLoader --> packshell

    PushPull --> primary
    PushPull --> mirror

    PROpened -->|"trigger workflow"| workflows
    workflows -->|"closes PR"| PROpened

    %% Click Events
    click vimrc "https://github.com/danirod/vimrc/tree/trunk/vimrc"
    click eruby "https://github.com/danirod/vimrc/blob/trunk/ftplugin/eruby.vim"
    click markdown "https://github.com/danirod/vimrc/blob/trunk/ftplugin/markdown.vim"
    click rubyft "https://github.com/danirod/vimrc/blob/trunk/ftplugin/ruby.vim"
    click svelte "https://github.com/danirod/vimrc/blob/trunk/ftplugin/svelte.vim"
    click gitmodules "https://github.com/danirod/vimrc/blob/trunk/.gitmodules"
    click makefile "https://github.com/danirod/vimrc/tree/trunk/GNUmakefile"
    click packcoding "https://github.com/danirod/vimrc/tree/trunk/pack/coding"
    click packlsp "https://github.com/danirod/vimrc/tree/trunk/pack/lsp"
    click packshell "https://github.com/danirod/vimrc/tree/trunk/pack/shell"
    click edconfig "https://github.com/danirod/vimrc/blob/trunk/plugin/coding/editorconfig-vim.vim"
    click polyglot "https://github.com/danirod/vimrc/blob/trunk/plugin/coding/vim-polyglot.vim"
    click aleLoader "https://github.com/danirod/vimrc/blob/trunk/plugin/lsp/ale.vim"
    click vimlspLoader "https://github.com/danirod/vimrc/blob/trunk/plugin/lsp/vim-lsp.vim"
    click fzfLoader "https://github.com/danirod/vimrc/blob/trunk/plugin/shell/fzf.vim"
    click nerdtreeLoader "https://github.com/danirod/vimrc/blob/trunk/plugin/shell/nerdtree.vim"
    click undodir "https://github.com/danirod/vimrc/tree/trunk/undodir/"
    click workflows "https://github.com/danirod/vimrc/blob/trunk/.github/workflows/closepr.yml"

    %% Styles
    classDef configCol fill:#cfe2f3,stroke:#000,stroke-width:1px
    classDef pluginCol fill:#d9ead3,stroke:#000,stroke-width:1px
    classDef buildCol fill:#fff2cc,stroke:#000,stroke-width:1px
    classDef ciCol fill:#f9cb9c,stroke:#000,stroke-width:1px
    classDef remoteCol fill:#d9d2e9,stroke:#000,stroke-width:1px
    classDef dataCol fill:#eeeeee,stroke:#000,stroke-width:1px
    classDef external fill:#ffffff,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
```
