OpenCode keyboard shortcuts
OpenCode puts most TUI actions behind a leader key so the terminal stays usable for text input. Learn the leader sequence first, then use the session, panel, model, and command controls around it.
OpenCode keeps the prompt readable by putting many actions behind a leader sequence. Learn that sequence first, then use the session and panel controls to shape the conversation without reaching for the mouse.
Leader basics
Most actions start with the leader key, Ctrl+X by default: press it, release, then press the action key within two seconds. Ctrl+P opens the command palette, which shows the chord next to every command.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| Leader key that prefixes most chords | CtrlX | CtrlX | CtrlX |
| Open the command palette | CtrlP | CtrlP | CtrlP |
| Exit OpenCodeCtrl+D and Ctrl+X then q also exit. | CtrlC | CtrlC | CtrlC |
| Interrupt the current session | Esc | Esc | Esc |
Sessions
Create, switch, fork, and close sessions while keeping the agent context visible.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| New session | CtrlXN | CtrlXN | CtrlXN |
| List sessions | CtrlXL | CtrlXL | CtrlXL |
| Compact the session context | CtrlXC | CtrlXC | CtrlXC |
| Export the session to Markdown | CtrlXX | CtrlXX | CtrlXX |
| Show the session timeline | CtrlXG | CtrlXG | CtrlXG |
| Rename the session | CtrlR | CtrlR | CtrlR |
Panels and tools
Open the command palette, model picker, help, permissions, and the panels around the conversation.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| List models | CtrlXM | CtrlXM | CtrlXM |
| List themes | CtrlXT | CtrlXT | CtrlXT |
| Compose the message in an external editorUses the editor in your EDITOR environment variable. | CtrlXE | CtrlXE | CtrlXE |
| Toggle the sidebar | CtrlXB | CtrlXB | CtrlXB |
| Show the status view | CtrlXS | CtrlXS | CtrlXS |
| Copy the last messageCtrl+Shift+C also copies. | CtrlXY | CtrlXY | CtrlXY |
| Reference a file in your message | @ | @ | @ |
| Run the line as a shell command | ! | ! | ! |
Make the useful keys stick
OpenCode stays comfortable when the leader key becomes a quiet reflex. Learn the controls that protect your session first, then add the panels and model actions as your conversations get more involved.
You do not need this whole page in your head. Pick two shortcuts that remove a repeated hand movement, use them until they feel ordinary, and come back for the next pair.