# pi-modal-editor

Helix-aligned modal editor for pi's prompt input. Six modes, motion-first editing, Kakoune-inspired registers.

## Install

```bash
pi install npm:pi-modal-editor
```

## Modes

| Mode      | Indicator | Enter via |
| --------- | --------- | --------- |
| Normal    | `--`      | `Esc`     |
| Insert    | `[i]`     | `i` / `a` |
| Selection | `[v]`     | `v`       |
| Surround  | `[s]`     | `m`       |
| Register  | `["]`     | `"`       |
| History   | `[h]`     | `Ctrl+k`  |

## Keybindings

### Normal

| Keys       | Action              |
| ---------- | ------------------- |
| `i/a`      | Insert before/after |
| `I/A`      | Insert at start/end |
| `v`        | Selection mode      |
| `h/l`      | Left/right          |
| `w/b/e`    | Word motions        |
| `0/$`      | Line start/end      |
| `d/D`      | Delete char/to end  |
| `y/Y`      | Yank char/line      |
| `p/P`      | Paste after/before  |
| `m`        | Surround mode       |
| `"`        | Register mode       |
| `Ctrl+k/j` | History prev/next   |
| `u/U`      | Undo/redo           |

### Selection (`v`)

| Keys      | Action      |
| --------- | ----------- |
| `h/l/w/b` | Expand      |
| `d/y`     | Delete/yank |
| `m`       | Surround    |
| `Esc`     | Normal      |

### Surround (`m`)

Wrap selection with `( ) [ ] { } " ' \``

### Register (`"`)

Press `a–z` to select a named register, then `y`/`p` to yank/paste.

### History (`Ctrl+k`)

`k/j` or `↑/↓` to navigate, `Enter` to load, `Esc` to cancel.

## Commands

```bash
pi /modal-editor:mode
pi /modal-editor:content
pi /modal-editor:help
```

## License

MIT
