$ show Amansingh-afk/milli.nvim
milli.nvim is a Neovim plugin for animated ASCII splash screens. It provides both pre-rendered splash animations (like fire, blackhole, skeleton) and live procedural shaders (plasma, rain, doomfire, starfield) all implemented in pure Lua using Neovim’s extmarks for coloring. The plugin integrates seamlessly with popular dashboard plugins (dashboard-nvim, alpha-nvim, snacks.nvim, mini.starter) via autocmds and preset functions. It also includes a community registry for sharing splash data, with a sandboxed loading mechanism to prevent arbitrary code execution. The codebase demonstrates careful engineering: anchor-based positioning to handle variable terminal sizes, color-run optimisation to stay within Neovim’s highlight-group limit (E849), and deterministic pseudorandom number generation in shaders to avoid corrupting math.random. The external CLI tool (npm package `milli`) allows users to generate their own splashes from images or GIFs, and the data format is simple and portable. Overall, it is a well-crafted, feature-rich plugin with clear architecture and several reusable patterns.
The LLM identified 3 files worth highlighting for reuse:
Defines the contract that all procedural shaders must follow: a `new()` function returning state and a `frame()` function producing `{ lines, colors }` tables. Includes helper functions for color quantization (4 bits/channel), HSV conversion, and a deterministic LCG random number generator. This module is self-contained and could be extracted to build any Lua-based animation system with bounded highlight-group usage.
Implements the `:MilliInstall` and `:MilliUninstall` commands for downloading splash modules from a remote registry. Downloads Lua modules from a GitHub raw URL and validates them by loading in an empty sandbox environment (`load(content, … , 't', {})`) to block arbitrary code execution before saving to `stdpath('data')`. This pattern is reusable for any Neovim plugin that needs to safely install community-contributed data files.
Core playback engine that loads splash data, paints frames via extmarks, and manages per-buffer animations. Uses an anchor search to locate a unique non‑blank character in the first frame, then computes padding dynamically for any buffer size. Color runs (adjacent cells with same foreground/background) are merged to minimize highlight-group creations – a non‑obvious optimisation to avoid Neovim’s E849 limit. While tightly coupled to Neovim APIs, the anchor and run‑merging patterns are transferable to other terminal rendering projects.