Repository navigation
Plugin API Hub
GridLock provides a modular, zero-core-linkage C99 Plugin ABI v2.0 (GRIDLOCK_PLUGIN_API_VERSION = 0x00020000u, entry symbol gridlock_plugin_init) with first-class authoring support across C99, C++23, and Lua / LuaJIT.
-
C99 ABI v2.0 Reference - Complete
gridlock_host_api_tvtable specification, sub-tables (core,buf,keymap,autocmd,dbg,ui,marks_regs,diag),plugin.mapsymbol hiding, version/size handshakes, threading guarantees, and a buildable C99 example. -
C++23 Plugin & Host Extension Guide -
extern "C"linkage,noexceptexception firewalls,std::expected/std::span/ RAII wrappers,domain_mesh_probewalkthrough, and Meson/CMake build recipes. -
Lua 5.1 / LuaJIT
gl.*API Reference - Optionalplugins/gridlock_lua/scripting host (-Dlua=auto|enabled|disabled),init.lua& offline LuaRocks loading, watchdog/sandbox model, completegl.*parameter tables (gl.dbg.eval,gl.dbg.add_breakpointtracepoints,AnchorStoreextmarks), and live GDB stack/memory + 2D heatmap examples.
| Criterion | Lua / LuaJIT (gl.*) |
Pure C99 (plugin_api.h) |
C++23 (extern "C") |
|---|---|---|---|
| Best For | Rapid workflow automation, keymaps, autocmds, live GDB/MI HUDs, 2D canvas prototypes, init.lua workstation configs |
Minimal-dependency binary plugins, Rust/Zig/Fortran FFI targets, strict ABI-only scientific probes | Complex HPC/solver extensions (HDF5, VTK, Eigen, PETSc/MFEM), RAII resource management, high-throughput memory parsing |
| Build Step | None (hot-reload via lua.reload_init or Ctrl+Shift+R in Playground) |
cc -std=c99 -shared -fPIC |
Meson / CMake / Make (-std=c++23) |
| Core Linkage | Loaded via optional libgridlock_lua.so (zero liblua in core) |
Zero Qt6 / zero C++ stdlib linkage | Zero Qt6 linkage (noexcept C99 boundary) |
| Safety Guardrails |
1,000,000-instruction watchdog + untrusted workspace sandbox |
Host boundary validation + alloc_bytes leak tracking |
Host boundary validation + std::expected / noexcept firewall |
| Distribution | Single init.lua or ~/.config/gridlock/lua/ modules |
Prebuilt .so/.dylib/.dll or Git repo via plugins.toml
|
Prebuilt .so/.dylib/.dll or Git repo via plugins.toml
|
Core gridlock never links liblua and never exposes Qt6 headers across the plugin boundary. Every native plugin compiles strictly against the pure-C99 headers in include/gridlock/:
| Header | Sub-table / Role |
|---|---|
include/gridlock/plugin_api.h |
Root gridlock_host_api_t, gridlock_plugin_descriptor_t, gridlock_plugin_init
|
include/gridlock/plugin_core_api.h |
host->core (alloc_bytes, free_bytes, log_message, paths, trust, defer_fn) |
include/gridlock/plugin_buf_api.h |
host->buf (virtual buffers, line slices, cursor/selection, extmarks) |
include/gridlock/plugin_keymap_api.h |
host->keymap (commands, modal/chorded keymaps, leader key, editor mode) |
include/gridlock/plugin_autocmd_api.h |
host->autocmd (priority-ordered, glob-filtered, vetoable hooks) |
include/gridlock/plugin_dbg_api.h |
host->dbg (rank telemetry, send_mi_async, type visualizers, badges, DWARF/memory) |
include/gridlock/plugin_ui_api.h |
host->ui (panels, 2D retained-mode canvases, heatmaps, popups, status segments, prompts) |
include/gridlock/plugin_editor_extras_api.h |
host->marks_regs & host->diag (marks, registers, namespaced diagnostics) |
sequenceDiagram
participant Host as GridLock (PluginManager + PluginHostBridge)
participant Plug as Plugin (.so / init.lua)
participant Sub as IPluginSubsystems (buf, keymap, autocmd, dbg, ui, core)
Host->>Plug: 1. init: gridlock_plugin_init(host, &out_desc)
Plug-->>Host: Populate api_version (0x00020000u), metadata, plugin_ctx, shutdown
Plug->>Sub: 2. register: commands, keymaps, autocmds, visualizers, panels/canvases
loop Active Session
Sub->>Plug: 3. dispatch: autocmd / keymap / command / MI reply / canvas click & key / defer_fn
Plug->>Sub: Update panels, extmarks, diagnostics, badges, or canvas draw lists
end
Host->>Plug: 4. shutdown: on_session_end() -> shutdown(plugin_ctx, host)
Host->>Sub: Sweep numericPluginId (close panels/popups, cancel timers, reclaim leaks)
Host->>Plug: QLibrary::unload()
Every loaded plugin receives a private gridlock_host_api_t copy bound to a unique PluginBindingContext. When a plugin is disabled, hot-reloaded, or unloaded, every IPluginSubsystem automatically reclaims its panels, floating dialogs, timers, keymaps, autocmds, type visualizers, rank badges, diagnostics, marks, and tracked allocations.
Test native plugins and init.lua scripts without touching ~/.config/gridlock:
mkdir -p /tmp/gl-sandbox/plugins
cp builddir/plugins/gridlock_lua/libgridlock_lua.so /tmp/gl-sandbox/plugins/
cp plugins/examples/mpi_workflow_lua/init.lua /tmp/gl-sandbox/init.lua
# CLI flag (highest precedence) or environment variable:
./builddir/gridlock --config-dir /tmp/gl-sandbox
GRIDLOCK_CONFIG_DIR=/tmp/gl-sandbox ./builddir/gridlockPrecedence order: --config-dir > GRIDLOCK_CONFIG_DIR > GRIDLOCK_TEST_CONFIG_DIR > ~/.config/gridlock.
Gate every native plugin CI workflow on gridlock --verify-plugin <path.so>. It runs headlessly inside a temporary sandbox without opening a GUI window or mutating ~/.config/gridlock/:
# Example GitHub Actions / GitLab CI verification step:
QT_QPA_PLATFORM=offscreen gridlock --verify-plugin ./build/libmy_plugin.so--verify-plugin exits 0 ([PASS]) only when all four gates pass (exit 1 on [FAIL]):
-
Symbol Hygiene: Resolves
gridlock_plugin_initand warns on extra globalSTT_FUNCorSTB_GNU_UNIQUEsymbols that prevent cleandlclose()hot-reloading. -
ABI v2.0 Handshake: Validates
out_desc->api_version == 0x00020000u,struct_size, and non-empty UTF-8 metadata (plugin_id_utf8,plugin_name_utf8,plugin_version_utf8). - Registration Validation: Verifies commands, keymaps, visualizers, and PCRE2 regexes commit cleanly.
-
Dry-Run Lifecycle & Zero Leaks: Runs
init->on_session_start(2)->on_session_end()->shutdown()and fails ifoutstandingAllocBytes() != 0.
Enable the opt-in Plugin Playground for instant, zero-install Lua and C99 iteration:
meson setup builddir -Dlua=auto -Dplugin_playground=true
ninja -C builddir
./builddir/gridlock --config-dir /tmp/gl-sandboxOpen the PLAYGROUND tab in the left sidebar (FILES | SYMBOLS | STRINGS | PLAYGROUND), pick a built-in Lua/C99 starter or blank scratchpad, press Ctrl+Shift+R (Run / Reload) to compile/evaluate in isolation, Ctrl+S to save to disk, or Unload to tear down all playground panels, timers, and keymaps cleanly.
GridLock Repository | Releases | Report an Issue | Roadmap | Accessibility | License (MIT)
Documentation mirrored from docs/ on master.
Getting Started & Tutorials
Debugging Workflows
- UI & Debugging Manual
- View Modes & Layout
- Build & Find in Files
- Server Rack View
- MPI Diagnostics & HPC
- OpenMP OMPD Inspector
- Memory, RE & Profiling
- Struct Layout & Cache Lines
- Reference Manual & Packages
Customization & Reference
- Configuration & Themes
- Vim Modal Editing
- Keyboard Shortcuts
- GDB Reference & Cheat Sheet
- Screenshot Gallery
- Engineering Roadmap
Extending & Architecture