文档
English Docs
TUI

TUI

OpenCode provides an interactive terminal user interface for collaborating with LLMs. Launch by running opencode in your project directory.

Core Features

File References

Use @ to reference files in messages:

How is auth handled in @packages/functions/src/api/index.ts?

Bash Command Execution

Prefix messages with ! to execute shell commands:

!ls -la

Slash Commands

CommandDescriptionKeybind
/connectAdd provider and API keys
/compactCompact sessionctrl+x c
/detailsToggle tool detailsctrl+x d
/editorOpen external editorctrl+x e
/exitExit OpenCodectrl+x q
/exportExport to Markdownctrl+x x
/helpDisplay helpctrl+x h
/initCreate AGENTS.mdctrl+x i
/modelsList modelsctrl+x m
/newStart new sessionctrl+x n
/redoRedo messagectrl+x r
/sessionsSwitch sessionsctrl+x l
/shareShare sessionctrl+x s
/themesList themesctrl+x t
/undoUndo last messagectrl+x u

Editor Configuration

Set your EDITOR environment variable:

# Linux/macOS
export EDITOR=nano
export EDITOR="code --wait"
 
# Windows PowerShell
$env:EDITOR = "code --wait"

Configuration

Customize TUI behavior in opencode.json:

{
  "tui": {
    "scroll_speed": 3,
    "scroll_acceleration": {
      "enabled": true
    }
  }
}

Options:

  • scroll_acceleration.enabled - macOS-style scroll acceleration
  • scroll_speed - Scrolling velocity (minimum: 1)