Pair plugin for reovim - bracket matching, highlighting, and auto-pair insertion
This plugin provides:
- Rainbow bracket coloring based on nesting depth (6-color cycle)
- Matched pair highlighting when cursor is inside brackets
- Bold + underline highlighting when cursor is directly ON a bracket
- Unmatched bracket warning (red underline)
- Auto-insertion of closing brackets with cursor positioning
Supported Brackets
- Round brackets:
() - Square brackets:
[] - Curly brackets:
{} - Backticks:
`(for markdown code, template literals) - Single quotes:
' - Double quotes:
"
Note: Angle brackets <> are intentionally excluded as they conflict with
operators (->, =>, <=, >=, <<, >>) in most languages.
Symmetric pairs (backticks, quotes) use a tracking mechanism to prevent infinite recursion when auto-inserting the closing character.
Highlighting Behavior
| Cursor Position | Style |
|---|---|
On bracket ( or ) |
Rainbow color + bold + underline |
Inside (...) |
Rainbow color only |
| Unmatched bracket | Red + underline |
State Management
The plugin stores PairState in PluginStateRegistry, tracking:
- Cached bracket depth information per buffer
- Current matched pair (if cursor is inside or on a bracket)