# derekgou/omnivim architecture

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

- Interactive diagram: https://gitdiagram.com/derekgou/omnivim
- Repository: https://github.com/derekgou/omnivim

## Overview

##### Project Type and Purpose
- The project's intent is to augment the developer workflow by globally enabling Vim-like navigation and editing modes in any running application.

##### Analyzing the File Structure
- Top-Level Files:
- Files like main.py and gui.py likely serve as entry points for either launching the Omnivim core functionality or the GUI interface.
- build.bat and setup.bat are deployment and build scripts used to compile, setup, or prepare the project.
- style.css suggests that there is styling for the GUI, making it visually consistent with the tool’s design.
- The Windows_Mouse_Movments Directory:
- This folder contains the mode-specific scripts: main_windows.py (possibly the central controller for window-related logic), mouse_mode.py, normal_mode.py, visual_mode.py, and write_mode.py.
- This organization indicates a modular design where each mode’s functionality is encapsulated within its own file/module.
- Other Elements:
- .gitignore indicates version control practices.

##### Information from the README
- Detailed explanations of the various modes and keybindings are provided, covering Normal, Insert, Visual, Mouse, and Kill modes.
- The project’s lightweight footprint (using less than 1% CPU) hints at efficient internal communication and minimal resource consumption in its design.

- Main Components:
- GUI Component:
- Mode Manager:
▪ The Windows_Mouse_Movments folder contains individual controllers for each mode (normal_mode.py, mouse_mode.py, visual_mode.py, write_mode.py). main_windows.py likely orchestrates these modules.
- Core Entry Point & Initialization:
▪ main.py acts as an entry point, initializing the application and possibly determining which mode and GUI are launched.
- Build / Setup Infrastructure:
▪ build.bat and setup.bat encapsulate the deployment processes, which might be represented as external scripts or modules that “prepare” the system.
- Assets & Resources:
- Relationships and Data Flow:
- The GUI may also reflect state changes by accessing or receiving updates from these mode modules.
- Important Architectural Patterns:
- Modularity: Each mode is encapsulated in its own module, supporting a clear separation of concerns.
- Lightweight Design: Emphasis is placed on low CPU usage, implying that internal communications and processes are optimized.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Input
    U("User Input"):::user

    %% User Interface Layer
    subgraph "User Interface"
        GUI["Tray GUI (gui.py & style.css)"]:::gui
    end

    %% Core Controller Layer
    subgraph "Core"
        CORE["Core Application Entry (main.py)"]:::core
    end

    %% Mode Management Subsystem
    subgraph "Mode Management"
        MC["Central Controller (main_windows.py)"]:::mode
        NM["Normal Mode Handler (normal_mode.py)"]:::mode
        MM["Mouse Mode Handler (mouse_mode.py)"]:::mode
        VM["Visual Mode Handler (visual_mode.py)"]:::mode
        WM["Write/Kill Mode Handler (write_mode.py)"]:::mode
    end

    %% Deployment/Setup Infrastructure
    subgraph "Deployment"
        BLD["Build Script (build.bat)"]:::deployment
        SET["Setup Script (setup.bat)"]:::deployment
    end

    %% Assets & Resources
    subgraph "Assets"
        AS["Resources (Images Directory)"]:::assets
    end

    %% Connections
    U -->|"triggers"| GUI
    GUI -->|"sends event"| CORE
    CORE -->|"routes to"| MC
    MC -->|"invokes"| NM
    MC -->|"invokes"| MM
    MC -->|"invokes"| VM
    MC -->|"invokes"| WM
    AS -- "assets loaded" --> GUI

    %% Click Events
    click CORE "https://github.com/derekgou/omnivim/blob/main/main.py"
    click GUI "https://github.com/derekgou/omnivim/blob/main/gui.py"
    click GUI "https://github.com/derekgou/omnivim/blob/main/style.css"
    click MC "https://github.com/derekgou/omnivim/blob/main/Windows_Mouse_Movements/main_windows.py"
    click NM "https://github.com/derekgou/omnivim/blob/main/Windows_Mouse_Movements/normal_mode.py"
    click MM "https://github.com/derekgou/omnivim/blob/main/Windows_Mouse_Movements/mouse_mode.py"
    click VM "https://github.com/derekgou/omnivim/blob/main/Windows_Mouse_Movements/visual_mode.py"
    click WM "https://github.com/derekgou/omnivim/blob/main/Windows_Mouse_Movements/write_mode.py"
    click BLD "https://github.com/derekgou/omnivim/blob/main/build.bat"
    click SET "https://github.com/derekgou/omnivim/blob/main/setup.bat"
    click AS "https://github.com/derekgou/omnivim/tree/main/Images"

    %% Styles
    classDef user fill:#F8B195,stroke:#000,stroke-width:2px;
    classDef gui fill:#C06C84,stroke:#000,stroke-width:2px;
    classDef core fill:#F67280,stroke:#000,stroke-width:2px;
    classDef mode fill:#355C7D,stroke:#000,stroke-width:2px;
    classDef deployment fill:#6C5B7B,stroke:#000,stroke-width:2px;
    classDef assets fill:#F8B195,stroke:#000,stroke-width:2px;
```
