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.

ActionWindowsmacOSLinux
Leader key that prefixes most chordsCtrlXCtrlXCtrlX
Open the command paletteCtrlPCtrlPCtrlP
Exit OpenCodeCtrl+D and Ctrl+X then q also exit.CtrlCCtrlCCtrlC
Interrupt the current sessionEscEscEsc

Sessions

Create, switch, fork, and close sessions while keeping the agent context visible.

ActionWindowsmacOSLinux
New sessionCtrlXNCtrlXNCtrlXN
List sessionsCtrlXLCtrlXLCtrlXL
Compact the session contextCtrlXCCtrlXCCtrlXC
Export the session to MarkdownCtrlXXCtrlXXCtrlXX
Show the session timelineCtrlXGCtrlXGCtrlXG
Rename the sessionCtrlRCtrlRCtrlR

Panels and tools

Open the command palette, model picker, help, permissions, and the panels around the conversation.

ActionWindowsmacOSLinux
List modelsCtrlXMCtrlXMCtrlXM
List themesCtrlXTCtrlXTCtrlXT
Compose the message in an external editorUses the editor in your EDITOR environment variable.CtrlXECtrlXECtrlXE
Show the status viewCtrlXSCtrlXSCtrlXS
Copy the last messageCtrl+Shift+C also copies.CtrlXYCtrlXYCtrlXY
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.

Make a printable sheet for this app