hjkl-bonsai
Tree-sitter grammar registry + highlighter for the hjkl editor stack.
Renamed from
hjkl-tree-sitter. The previous name's git history is preserved here via the GitHub repo rename redirect. Thehjkl-tree-sittercrate on crates.io stays as a deprecated artifact at 0.5.0; new releases ship underhjkl-bonsai.
Currently bundles 27 grammars (Rust, Markdown, JSON, TOML, SQL, Python,
JavaScript, TypeScript, TSX, Go, YAML, Bash, C, C++, C#, HTML, CSS, Java, PHP,
Ruby, Swift, Lua, Dart, R, Make, XML, Diff) and exposes a Helix-flavored
capture-name theming system compatible with Neovim capture-name conventions.
Language detection by file extension. Highlights are returned as a flat list
of (byte_range, capture_name) spans for renderers to style.
Roadmap
hjkl-bonsai is pivoting away from bundled grammars to a Helix-style
compile-on-demand loader: when a grammar isn't found in the system or
user paths, fetch its source (pinned via a manifest), compile with cc on
the user's machine, cache to ~/.cache/hjkl/grammars/. Distros can ship
pre-compiled .so files in /usr/share/hjkl/runtime/grammars/ so end users
never need a compiler. The bundled-grammar approach (current) caps at ~30
languages without ballooning the binary; the runtime loader will scale to
the full Helix/nvim-treesitter list (~300).
Status
27 bundled grammars, DotFallbackTheme for dark/light theming, incremental
re-parse via tree-sitter::InputEdit.
Usage
= "0.1"
use ;
let registry = new;
let config = registry.by_name.unwrap;
let mut highlighter = new.unwrap;
let spans = highlighter.highlight;
let theme = dark;
for span in &spans
License
MIT. See LICENSE.