Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created December 31, 2025 17:31
Show Gist options
  • Select an option

  • Save johnlindquist/e2a9c28e8dd6c6434a635507b5a32540 to your computer and use it in GitHub Desktop.

Select an option

Save johnlindquist/e2a9c28e8dd6c6434a635507b5a32540 to your computer and use it in GitHub Desktop.
OpenCode Keyboard Shortcuts Reference

OpenCode Keyboard Shortcuts

A comprehensive reference for OpenCode keyboard shortcuts.

Leader Key: Ctrl+X (used as <leader> prefix for many shortcuts)

Quick Reference - Most Used

Action Shortcut
Exit app Ctrl+C, Ctrl+D, or <leader>q
Command palette Ctrl+P
New session <leader>n
List sessions <leader>l
Scroll to bottom End or Ctrl+Alt+G
Scroll to top Home or Ctrl+G
Interrupt/Cancel Escape
Submit input Enter
New line in input Shift+Enter, Ctrl+Enter, or Alt+Enter

Application Control

Action Shortcut Description
Exit application Ctrl+C, Ctrl+D, <leader>q Quit OpenCode
Command list Ctrl+P Open command palette
Open external editor <leader>e Edit in your $EDITOR
List themes <leader>t Switch themes
Toggle sidebar <leader>b Show/hide sidebar
View status <leader>s Show status info
Toggle tips <leader>h Toggle home screen tips
Suspend terminal Ctrl+Z Suspend to background

Session Management

Action Shortcut Description
New session <leader>n Create new session
List sessions <leader>l Browse all sessions
Session timeline <leader>g View session history
Export session <leader>x Export to editor
Compact session <leader>c Compress session context
Interrupt Escape Stop current operation
Next child session <leader>Right Navigate to child
Previous child session <leader>Left Navigate to previous child
Parent session <leader>Up Go to parent session

Message Navigation

Action Shortcut Description
Scroll to top Ctrl+G, Home Jump to first message
Scroll to bottom Ctrl+Alt+G, End Jump to last message
Page up PageUp Scroll up one page
Page down PageDown Scroll down one page
Half page up Ctrl+Alt+U Scroll up half page
Half page down Ctrl+Alt+D Scroll down half page
Copy message <leader>y Copy to clipboard
Undo message <leader>u Undo last message
Redo message <leader>r Redo message
Toggle code blocks <leader>h Collapse/expand code

Model & Agent Selection

Action Shortcut Description
List models <leader>m Browse available models
Cycle recent models F2 Next recent model
Cycle recent (reverse) Shift+F2 Previous recent model
List agents <leader>a Browse agents
Next agent Tab Cycle to next agent
Previous agent Shift+Tab Cycle to previous agent

Input Field

Action Shortcut Description
Submit Enter Send message
New line Shift+Enter, Ctrl+Enter, Alt+Enter, Ctrl+J Insert line break
Clear input Ctrl+C Clear input field
Paste Ctrl+V Paste from clipboard
Move left Left, Ctrl+B Cursor left
Move right Right, Ctrl+F Cursor right
Move up Up Cursor up
Move down Down Cursor down
Start of line Ctrl+A Jump to line start
End of line Ctrl+E Jump to line end
Select left Shift+Left Extend selection left
Select right Shift+Right Extend selection right
Select up Shift+Up Extend selection up
Select down Shift+Down Extend selection down
Select to line start Ctrl+Shift+A Select to beginning
Select to line end Ctrl+Shift+E Select to end

Customization

Add to your opencode.json to customize keybindings:

{
  "$schema": "https://opencode.ai/config.json",
  "keybinds": {
    "leader": "ctrl+x",
    "messages_last": "ctrl+alt+g,end",
    "messages_first": "ctrl+g,home",
    "session_new": "<leader>n"
  }
}

Keybind Syntax

  • Multiple keys: separate with , (e.g., "ctrl+g,home")
  • Leader prefix: use <leader> (e.g., "<leader>n")
  • Modifiers: ctrl, alt, shift, meta
  • Disable: set to "none"

Tips

  1. Lost in a long conversation? Press End to jump to the bottom
  2. Want to review from the start? Press Home to jump to the top
  3. Need a fresh start? <leader>n creates a new session
  4. Wrong model? F2 quickly cycles through recent models
  5. Quick command access? Ctrl+P opens the command palette

Generated for OpenCode - https://github.com/sst/opencode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment