$ show ilai-deutel/kibi
Kibi is a minimal terminal-based text editor written in Rust, inspired by the kilo editor and constrained to under 1024 lines of code per platform (Unix, Windows, WASI). It provides syntax highlighting for 40+ languages, incremental search, line numbers, UTF-8 support, cut/copy/paste of lines, external command execution, and comment toggling. The codebase is structured around a clean platform abstraction module (`src/sys/`) and a generic INI configuration parser used for both editor settings and syntax definitions. Core editing logic lives in `src/editor.rs`, with row management and render mapping in `src/row.rs`. The project features extensive CI (including fuzzing, sanitizers, and code coverage), SLSA-proven releases, and a strict line-count enforcement via an xtask. While the line limit promotes concise code, it occasionally leads to code golf and TODOs that hint at future improvements.
The LLM identified 4 files worth highlighting for reuse:
Implements a generic, reusable INI file parser (`process_ini_file`) that is used for both editor configuration and syntax highlight definitions. The function accepts a file path and a callback to process sections, making it easily extractable for other projects needing a minimal INI parser with section handling.
The `Row` struct provides a bidirectional mapping between character indices and render column indices (`cx2rx` / `rx2cx`), handling tab expansion and UTF-8 width. This pattern is critical for any terminal application that needs to align cursor position with visual columns and is designed as a self-contained component.
Encapsulates terminal raw mode enable/disable, window size detection, and platform-specific escape sequence handling. It returns the original terminal settings for safe restoration and provides a clean interface that could be reused in any Rust CLI tool requiring raw terminal interaction.
Defines the syntax highlighting configuration types (`HlType`, `Conf`) and the logic to load them from INI files. The design is fully data-driven and can be extracted to build a standalone syntax highlighter or language server component, as it is independent of the editor's UI.