# hjkl-editor

Front-door for the hjkl modal editor stack: vim engine + rope buffer +
registers, in one crate.

[![CI](https://github.com/kryptic-sh/hjkl/actions/workflows/ci.yml/badge.svg)](https://github.com/kryptic-sh/hjkl/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/hjkl-editor.svg)](https://crates.io/crates/hjkl-editor)
[![docs.rs](https://img.shields.io/docsrs/hjkl-editor)](https://docs.rs/hjkl-editor)
[![MSRV](https://img.shields.io/badge/MSRV-1.95-blue.svg)](Cargo.toml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kryptic-sh/hjkl/blob/main/LICENSE)

Part of the [hjkl monorepo](https://github.com/kryptic-sh/hjkl) — a vim-modal
editor in Rust.

Re-exports the working parts of
[`hjkl-engine`](https://crates.io/crates/hjkl-engine) and
[`hjkl-buffer`](https://crates.io/crates/hjkl-buffer) under a curated namespace
so consumers (inbx, the `hjkl` binary, and others in the kryptic-sh stack) add
one dependency instead of three and don't need to know the crate-split.

## Status

Pre-1.0 — a stable facade over engine + buffer. Two surfaces coexist during the
0.x churn: the legacy [`runtime`] module and the [`spec`] module.

## Modules

| Module    | Surface                                                                                                                    |
| --------- | -------------------------------------------------------------------------------------------------------------------------- |
| `buffer`  | Re-export of `hjkl-buffer`: `Buffer`, `Edit`, `Position`, motion helpers, render path.                                     |
| `runtime` | Legacy runtime surface — the working sqeel-vim port: `Editor`, `Input`, `Key`, `Registers`, `LspIntent`, `KeybindingMode`. |
| `spec`    | Engine trait surface (additive): `Pos`, `Selection`, `SelectionSet`, `Host`, `Options`, `EngineError`.                     |

## Usage

```bash
cargo add hjkl-editor
```

```rust,no_run
use hjkl_editor::buffer::Buffer;
use hjkl_editor::runtime::{DefaultHost, Editor, Options};

let mut editor = Editor::new(
    Buffer::new(),
    DefaultHost::new(),
    Options::default(),
);
editor.set_content("hello world");
```

For host integration (clipboard, intent fan-out, etc.) implement a type that
satisfies `hjkl_editor::spec::Host`. The trait extraction will rewire `Editor`
to take it as a generic; in the meantime the host-shape stays compatible by
name.

## Documentation

[docs.rs/hjkl-editor](https://docs.rs/hjkl-editor)

## Contributing

See the
[monorepo CONTRIBUTING guide](https://github.com/kryptic-sh/hjkl/blob/main/CONTRIBUTING.md).

## License

MIT — see [LICENSE](https://github.com/kryptic-sh/hjkl/blob/main/LICENSE).
