$ show sphamba/smear-cursor.nvim
This is a Neovim plugin that animates the cursor with a smear effect, inspired by Neovide's animated cursor. It works in any terminal by using floating windows and Unicode block characters to render a smooth, physics-based trailing cursor. The plugin listens to cursor movement events and interpolates the cursor position using a spring-damper system, drawing the smear as a quad with sub-cell precision. It supports configurable stiffness, damping, particles, and various rendering modes (vertical bar, horizontal bar, diagonal blocks, braille). The codebase is modular, with clear separation between animation logic, drawing, color management, and event handling. The drawing module is particularly noteworthy for its sophisticated use of Unicode symbols to achieve anti-aliased-like rendering in a terminal environment.
The LLM identified 3 files worth highlighting for reuse:
Implements sub-cell rendering of arbitrary quads using a variety of Unicode block characters (partial blocks, diagonal blocks, octants, braille, matrix characters). It precomputes quad geometry, determines edge types, and selects appropriate characters to fill cells with sub-cell shading. This module is self-contained and could be extracted as a general-purpose library for drawing anti-aliased-like shapes in a terminal.
Implements a physics-based spring animation system for the cursor smear. It maintains current and target corner positions, applies stiffness and damping per corner, and supports trailing effects with configurable exponents. Also includes a particle system for spark effects. The animation loop uses a fixed time step with lag compensation. This pattern is reusable for any smooth interpolation or physics-based animation in a game or UI context.
Manages dynamic highlight group generation for the smear cursor. It resolves cursor color from config, highlight groups, or treesitter, interpolates colors for gradient levels, and caches generated highlight groups to avoid repeated API calls. Supports both GUI and cterm colors, transparent backgrounds, and fallback colors. The caching pattern and color resolution logic are reusable for any Neovim plugin that needs dynamic highlighting.