$ show noborus/ov
ov is a feature-rich terminal pager written in Go, designed as a modern replacement for less/more. It supports large files via chunked reading with memory limits, ANSI escape sequence rendering, column alignment, word wrapping, search (case-insensitive, regex), follow/watch modes, multiple documents, sidebar panels (help, marks, doc list, sections, styles), mouse support, and extensive keybinding customization. The architecture is a single binary with a core `oviewer` package handling document management, screen drawing, event processing, and input modes. It uses `tcell` for terminal UI, `cobra` for CLI, `viper` for configuration, and supports compressed files (gzip, bzip2, zstd, lz4, xz). The codebase is well-tested with over 100 test files and demonstrates solid engineering practices including reusable patterns for bidirectional maps, ordered maps, converters, and input handling.
The LLM identified 5 files worth highlighting for reuse:
A thread-safe bidirectional map (BiMap) using sync.RWMutex. Allows lookups by key or value with O(1) average complexity. The implementation is self-contained, generic (Go 1.18+), and can be extracted for any project needing a two-way mapping with concurrent access.
An ordered map that preserves insertion order, implemented with a slice of keys and a map for values. Provides snapshot iterators and SetValues for bulk updates. Thread-safe via sync.RWMutex. Reusable for any scenario requiring ordered key-value storage with concurrent access.
Parses ANSI escape sequences (SGR, cursor movement) and applies styles to text. Uses a cache for parsed sequences to avoid re-parsing. The converter interface pattern (Convert, Clear) is cleanly separated and could be reused in other terminal applications needing escape sequence handling.
Implements a generic input handler with cursor management, candidate lists, and mode-specific behavior. Each input mode (search, goto, filter, etc.) implements a consistent interface (Mode, Prompt, Confirm, Up, Down). This pattern is reusable for any interactive terminal application requiring multiple input modes.
Manages file content in fixed-size chunks with an LRU eviction policy to limit memory usage. Supports reading, writing, and searching within chunks. The store/chunk abstraction is reusable for any application that needs to handle large files or streams with bounded memory.