> keyboard shortcuts
opencode is keyboard-first and uses a leader key — press it, then a letter — to avoid clashing with your terminal. The default leader is Ctrl+X, so Ctrl+X N is new session, Ctrl+X M is the model picker, and so on. Non-leader keys handle the fast path: Ctrl+P for the command palette, Tab to switch agents, Esc to interrupt, and Ctrl+T to cycle model variants. Every binding is rebindable in tui.json.
// keyboard shortcuts
5 commands// faq
What is the leader key in opencode?
The leader is a prefix key you press before a shortcut, defaulting to Ctrl+X. Actions written as <leader>+n mean 'press Ctrl+X, release, then press n.' It exists so opencode's many shortcuts do not collide with terminal or shell keybindings. You have about two seconds after the leader before it times out.
Why does Enter send my message before I finish typing?
Return submits the prompt in opencode. To add a line break instead, use Shift+Return (or Ctrl+Return, Alt+Return, or Ctrl+J). For anything long, press Ctrl+X E to compose in your real editor and send it back on save.
How do I stop opencode once it starts working?
Press Esc to interrupt the current response or tool call; the session and work done so far are kept, so you can immediately redirect. Esc only stops — it does not undo, so follow with /undo if the agent already wrote files you do not want.
Can I change the default keybinds?
Yes. Keybinds are defined in ~/.config/opencode/tui.json under a keybinds object, including the leader itself. Set a binding to a different key, a comma-separated list of keys, or "none" to disable it. This is also where you would move the leader off Ctrl+X if it conflicts with something you use.