# rafcamlet/nvim-luapad architecture

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

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

## Overview

##### Specific Implementation Details

**lua/luapad/**
- evaluator.lua (Core evaluation engine)
- state.lua (Instance management)
- config.lua (Configuration handling)
- completion.lua (Command completion)
- statusline.lua (Status integration)
- utils.lua (Utility functions)

##### External Integration Points

Connections to:
- Neovim API
- Buffer System
- Command Interface
- LSP Integration

##### Key Workflows

Main user interaction flows:
- Real-time evaluation path
- Error handling path
- Preview window activation
- Command execution flow

##### The integration points with Neovim's ecosystem

- Component types
- Special symbols

Keep the abstraction level focused on the architectural components while showing enough detail to understand the plugin's unique features like real-time evaluation and virtual text display.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Components
    subgraph Core
        Evaluator["Luapad Evaluator"]:::core
        StateManager["State Manager"]:::core
        ConfigManager["Configuration Manager"]:::core
    end

    %% Interface Layer
    subgraph Interface
        CmdInterface["Command Interface"]:::interface
        VimAutoload["VIM Autoload"]:::interface
        PluginInterface["Plugin Interface"]:::interface
        BufferMgmt["Buffer Management"]:::interface
    end

    %% Functional Modules
    subgraph Functions
        Completion["Completion System"]:::function
        StatusLine["Status Line Integration"]:::function
        PreviewWindow["Preview Window Manager"]:::function
    end

    %% Utility Layer
    subgraph Utils
        Tools["Tools and Helpers"]:::utility
        Context["Context Management"]:::utility
        ErrorHandler["Error Handling"]:::utility
        CmdRunner["Command Runner"]:::utility
        UtilFuncs["Utility Functions"]:::utility
    end

    %% External Integration
    subgraph External
        NeovimAPI["Neovim API"]:::external
        BufferSystem["Buffer System"]:::external
        LSP["LSP Integration"]:::external
    end

    %% Relationships
    Evaluator --> StateManager
    Evaluator --> ConfigManager
    CmdInterface --> Evaluator
    VimAutoload --> CmdInterface
    PluginInterface --> CmdInterface
    BufferMgmt --> Evaluator
    Completion --> CmdInterface
    StatusLine --> StateManager
    PreviewWindow --> BufferMgmt
    Tools --> Evaluator
    Context --> Evaluator
    ErrorHandler --> Evaluator
    CmdRunner --> Evaluator
    UtilFuncs --> Evaluator

    %% External Connections
    Evaluator -.-> NeovimAPI
    BufferMgmt -.-> BufferSystem
    Completion -.-> LSP

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef interface fill:#2ecc71,stroke:#27ae60,color:white
    classDef function fill:#f1c40f,stroke:#f39c12,color:black
    classDef utility fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Click Events
    click Evaluator "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/evaluator.lua"
    click StateManager "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/state.lua"
    click ConfigManager "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/config.lua"
    click CmdInterface "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/cmds.lua"
    click VimAutoload "https://github.com/rafcamlet/nvim-luapad/blob/master/autoload/luapad.vim"
    click PluginInterface "https://github.com/rafcamlet/nvim-luapad/blob/master/plugin/luapad.vim"
    click Completion "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/completion.lua"
    click StatusLine "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/statusline.lua"
    click Tools "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/tools.lua"
    click UtilFuncs "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/utils.lua"
    click Context "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/helper.lua"
    click CmdRunner "https://github.com/rafcamlet/nvim-luapad/blob/master/lua/luapad/run.lua"
```
