$ show lukas-reineke/indent-blankline.nvim
This Neovim plugin renders indentation guides using virtual text, avoiding the 'conceal' feature. It provides highly configurable indentation guides, including support for tabs, mixed indentation, and multiple highlight groups. The architecture is modular: `config.lua` handles a hierarchical configuration system with merging, validation, and buffer-scoped overrides; `hooks.lua` implements an extensible type-safe hook system that allows other plugins or user configurations to modify every aspect of the rendering pipeline; `indent.lua` performs whitespace analysis and classifies each cell into an enum (TAB_START, TAB_FILL, etc.); `scope.lua` uses Treesitter to determine the current scope (e.g., function body) for highlighting; and `virt_text.lua` composes the final virtual text extmarks. The plugin refreshes on cursor movement, option changes, and scrolling, with built-in debouncing. It integrates with Neovim's `listchars` and supports repeat_linebreak for wrapped lines. Test coverage is moderate but exercise key components. The code demonstrates mature Lua engineering with careful Neovim version compatibility and a clean public API.
The LLM identified 2 files worth highlighting for reuse:
Implements a config system with global defaults, per-buffer overrides, deep merge behavior (merge vs overwrite), and input validation. The `merge_configs` function intelligently combines list values for scope exclusions and filetype/buftype exclusions. This pattern can be extracted and reused in any plugin that needs layered configuration (global + per-buffer) with robust validation and custom merging rules.
Provides an extensible hook (callback) system with typed event types (ACTIVE, SCOPE_ACTIVE, SKIP_LINE, WHITESPACE, VIRTUAL_TEXT, etc.). Hooks can be registered globally or per-buffer. The system returns an ID for removal. It includes several built-in hooks (skip_preproc_lines, scope_highlight_from_extmark, hide_first_space_indent_level) that demonstrate the pattern. This modular event system could be extracted as a standalone generic callback registry for any Lua-based Neovim plugin.