OpenCode provides vim-style keyboard shortcuts and intuitive key bindings for efficient navigation and control.
Global shortcuts
These shortcuts work throughout the application:
Shortcut Action Ctrl+CQuit application (shows confirmation dialog) Ctrl+?Toggle help dialog showing all available shortcuts ?Toggle help dialog (when not in editing mode) Ctrl+LView application logs Ctrl+SSwitch to a different session Ctrl+KOpen command palette Ctrl+OOpen model selection dialog Ctrl+TOpen theme switcher Ctrl+FOpen file picker to select files for upload EscClose current dialog or overlay
Press Ctrl+? at any time to see context-sensitive shortcuts based on your current location in the application.
Chat page shortcuts
When in the main chat interface:
Shortcut Action Ctrl+NCreate a new session (clears current chat) Ctrl+XCancel current AI operation or generation iFocus editor (when not already in writing mode) EscExit writing mode and focus messages
The i key only focuses the editor when you’re not already typing. This mimics vim’s insert mode behavior.
Editor shortcuts
When the message editor is focused:
Shortcut Action EnterSend message (when editor is not focused) Ctrl+SSend message (when editor is focused) \ + EnterAdd a newline without sending the message Ctrl+EOpen external editor (set via $EDITOR environment variable) EscBlur editor and focus messages Ctrl+R + 0-9Delete attachment at the specified index Ctrl+R + RDelete all attachments EscCancel attachment delete mode
Use Ctrl+E to compose longer messages in your preferred editor like vim or nano. OpenCode creates a temporary markdown file for editing.
Message navigation
Navigate through the conversation history:
Shortcut Action PgUp or bScroll up one page PgDn or fScroll down one page Ctrl+UScroll up half a page Ctrl+DScroll down half a page
These vim-style navigation keys (b, f, Ctrl+U, Ctrl+D) work throughout the message area for efficient scrolling.
Session dialog shortcuts
When the session switcher is open (Ctrl+S):
Shortcut Action ↑ or kMove to previous session ↓ or jMove to next session EnterSelect the highlighted session EscClose dialog without switching
Model dialog shortcuts
When the model selection dialog is open (Ctrl+O):
Shortcut Action ↑ or kMove up in model list ↓ or jMove down in model list ← or hSwitch to previous provider → or lSwitch to next provider EnterSelect the highlighted model EscClose dialog without changing model
Use the horizontal navigation (h/l or arrow keys) to quickly browse models from different providers like OpenAI, Anthropic, and Google.
Permission dialog shortcuts
When the AI requests permission to perform an action:
Shortcut Action ← or LeftSwitch to previous option → or RightSwitch to next option TabSwitch to next option Enter or SpaceConfirm the selected option aAllow permission (one time) sAllow permission for entire session dDeny permission
The permission dialog displays diffs, commands, or URLs for you to review before approving. Use the viewport navigation shortcuts to scroll through large previews.
Command dialog shortcuts
When the command palette is open (Ctrl+K):
Shortcut Action ↑ or kMove to previous command ↓ or jMove to next command EnterExecute the highlighted command EscClose dialog without executing
Theme dialog shortcuts
When the theme switcher is open (Ctrl+T):
Shortcut Action ↑ or kMove to previous theme ↓ or jMove to next theme EnterApply the highlighted theme EscClose dialog without changing theme
File picker shortcuts
When the file picker is open (Ctrl+F):
Shortcut Action ↑ or kMove to previous file/directory ↓ or jMove to next file/directory EnterSelect file or enter directory EscClose file picker without selecting Arrow keys Navigate file tree
Logs page shortcuts
When viewing logs (Ctrl+L):
Shortcut Action EscReturn to chat page BackspaceReturn to chat page qReturn to chat page PgUp / PgDnScroll through logs Ctrl+U / Ctrl+DHalf-page scroll
Completion dialog shortcuts
When using the @ completion feature:
Shortcut Action @Trigger file/folder completion ↑ or kPrevious completion option ↓ or jNext completion option EnterSelect highlighted completion EscClose completion dialog
Type @ in the editor to autocomplete file and folder names, making it easy to reference specific files in your messages.
Vim-style navigation summary
OpenCode embraces vim keybindings for familiarity:
Movement
j / k for up/down
h / l for left/right
Ctrl+U / Ctrl+D for half-page scrolls
Modes
i to enter insert mode (focus editor)
Esc to exit insert mode
? for help (similar to vim’s :help)
Quick reference table
Print this table for quick reference:
Action Shortcut Send message Enter or Ctrl+SNew session Ctrl+NSwitch session Ctrl+SCancel operation Ctrl+XOpen commands Ctrl+KChange model Ctrl+OView help Ctrl+? or ?
Action Shortcut Page up PgUp or bPage down PgDn or fHalf page up Ctrl+UHalf page down Ctrl+DMove up ↑ or kMove down ↓ or j
Action Shortcut Close dialog EscConfirm selection EnterSwitch options ← / → or TabFiles Ctrl+FThemes Ctrl+TLogs Ctrl+L
Action Shortcut Allow once aAllow for session sDeny dNavigate options ← / → / TabConfirm Enter or Space
Custom keybindings are not currently supported, but shortcuts follow common terminal application conventions and vim patterns for familiarity.