# Keybindings file

> Every action the terminal UI's keys can be bound to, with its default keys.

{/* Generated from the default bindings in cmd/zelk/internal/tui/keymap (TestReferenceKeybindings). Don't edit: change the code, then run make reference. */}

The terminal UI's keys can be changed in `$XDG_CONFIG_HOME/zelk/keybindings.json` (`~/.config/zelk/keybindings.json`). The file takes Claude Code's format, so a file written for Claude Code works here as far as the actions are zelk's too.

```json
{
  "bindings": [
    {"context": "Chat", "bindings": {"ctrl+e": "chat:stash", "ctrl+s": null}},
    {"context": "Global", "bindings": {"ctrl+g ctrl+o": "app:toggleTranscript"}}
  ]
}
```

A binding adds to the defaults: a key bound to an action does it in place of what it did, the action's other keys still do it, and a key bound to `null` does nothing of zelk's, so it reaches the prompt as typing does. A chord is two keys separated by a space; the second must come within three seconds. A binding zelk can't use is skipped with a warning that names it; a file that isn't JSON, or has no `bindings` array, changes nothing.

No binding may take `ctrl+c` or `ctrl+d`: they always copy, close, clear and quit, so zelk can always be stopped.

## Contexts

| Context | Where |
|---|---|
| `Global` | wherever focus is |
| `Chat` | the prompt |
| `Task` | the prompt, while a run is under way |
| `Transcript` | a block of the transcript |

## Actions and their default keys

| Context | Action | Keys | Does |
|---|---|---|---|
| `Global` | `scroll:pageUp` | `pgup`, `shift+up` | Scroll the transcript, or a long dialog, up a page. |
| `Global` | `scroll:pageDown` | `pgdown`, `shift+down` | Scroll down a page. |
| `Global` | `scroll:top` | `ctrl+home` | Go to the start of the transcript. |
| `Global` | `scroll:bottom` | `ctrl+end` | Go to the end, and follow new output. |
| `Global` | `app:toggleTranscript` | `ctrl+o` | Show tool output and thinking in full. |
| `Global` | `app:toggleTodos` | `ctrl+t` | Show or hide the task list. |
| `Global` | `history:search` | `ctrl+r` | Search earlier prompts. |
| `Chat` | `chat:submit` | `enter` | Send the prompt, or steer the run under way. |
| `Chat` | `chat:newline` | `shift+enter`, `ctrl+j`, `alt+enter` | Start a new line in the prompt. |
| `Chat` | `chat:sendNow` | `ctrl+enter`, `ctrl+x ctrl+s` | Send queued messages now, moving running work to the background. |
| `Chat` | `chat:cancel` | `esc` | Interrupt a run. Twice: clear the draft, or on an empty prompt open the rewind menu. |
| `Chat` | `chat:cycleMode` | `shift+tab` | Move to the next permission mode. |
| `Chat` | `chat:stash` | `ctrl+s` | Stash the draft, or bring a stashed one back. |
| `Chat` | `chat:imagePaste` | `ctrl+v`, `alt+v` | Paste an image from the clipboard. |
| `Chat` | `chat:focusTranscript` | `tab` | Move focus to the transcript's blocks. |
| `Chat` | `chat:palette` | none | Open the command palette, as `/` on an empty prompt does. |
| `Task` | `task:background` | `ctrl+b`, `ctrl+x ctrl+b` | Move running commands and subagents to the background. |
| `Transcript` | `transcript:prev` | `up` | Select the block before. |
| `Transcript` | `transcript:next` | `down` | Select the block after. |
| `Transcript` | `transcript:toggle` | `enter` | Expand or collapse the selected block. |
| `Transcript` | `transcript:copy` | `c` | Copy the selected block. |
| `Transcript` | `transcript:fix` | `f` | Ask zelk to fix the selected failure. |
| `Transcript` | `transcript:exit` | `esc`, `tab` | Give focus back to the prompt. |
