TUI
Arbeite mit OpenCode in der Terminal-Oberflaeche.
OpenCode bietet eine interaktive Terminaloberflaeche (TUI), um mit einem LLM an deinen Projekten zu arbeiten.
Ohne weitere Argumente startet OpenCode die TUI im aktuellen Verzeichnis.
opencodeOder du startest sie fuer ein bestimmtes Arbeitsverzeichnis.
opencode /path/to/projectIn der TUI kannst du direkt mit einer Nachricht prompten.
Give me a quick summary of the codebase.Datei-Referenzen
Mit @ kannst du Dateien in Nachrichten referenzieren.
Dabei wird im aktuellen Verzeichnis eine unscharfe Dateisuche genutzt.
How is auth handled in @packages/functions/src/api/index.ts?Der Dateiinhalt wird automatisch zur Unterhaltung hinzugefuegt.
Bash commands
Beginne eine Nachricht mit !, um einen Shell-Befehl auszufuehren.
!ls -laDie Ausgabe landet als Tool-Ergebnis in der Unterhaltung.
Commands
In der OpenCode-TUI kannst du / plus Befehlsnamen eingeben, um Aktionen schnell auszufuehren.
Zum Beispiel:
/helpViele Befehle haben auch Tastenkombinationen mit ctrl+x als Leader-Key.
Mehr dazu.
Hier sind alle verfuegbaren Slash-Commands:
connect
Add a provider to OpenCode. Allows you to select from available providers and add their API keys.
/connectcompact
Compact the current session. Alias: /summarize
/compactKeybind: ctrl+x c
details
Toggle tool execution details.
/detailsKeybind: ctrl+x d
editor
Open external editor for composing messages. Uses the editor set in your EDITOR environment variable. Learn more.
/editorKeybind: ctrl+x e
exit
Exit OpenCode. Aliases: /quit, /q
/exitKeybind: ctrl+x q
export
Export current conversation to Markdown and open in your default editor. Uses the editor set in your EDITOR environment variable. Learn more.
/exportKeybind: ctrl+x x
help
Show the help dialog.
/helpKeybind: ctrl+x h
init
Create or update AGENTS.md file. Learn more.
/initKeybind: ctrl+x i
models
List available models.
/modelsKeybind: ctrl+x m
new
Start a new session. Alias: /clear
/newKeybind: ctrl+x n
redo
Redo a previously undone message. Only available after using /undo.
Internally, this uses Git to manage the file changes. So your project needs to be a Git repository.
/redoKeybind: ctrl+x r
sessions
List and switch between sessions. Aliases: /resume, /continue
/sessionsKeybind: ctrl+x l
share
Share current session. Learn more.
/shareKeybind: ctrl+x s
themes
List available themes.
/themeKeybind: ctrl+x t
thinking
Toggle the visibility of thinking/reasoning blocks in the conversation. When enabled, you can see the model’s reasoning process for models that support extended thinking.
/thinkingundo
Undo last message in the conversation. Removes the most recent user message, all subsequent responses, and any file changes.
Internally, this uses Git to manage the file changes. So your project needs to be a Git repository.
/undoKeybind: ctrl+x u
unshare
Unshare current session. Learn more.
/unshareEditor setup
Both the /editor and /export commands use the editor specified in your EDITOR environment variable.
# Example for nano or vimexport EDITOR=nanoexport EDITOR=vim
# For GUI editors, VS Code, Cursor, VSCodium, Windsurf, Zed, etc.# include --waitexport EDITOR="code --wait"To make it permanent, add this to your shell profile;
~/.bashrc, ~/.zshrc, etc.
set EDITOR=notepad
# For GUI editors, VS Code, Cursor, VSCodium, Windsurf, Zed, etc.# include --waitset EDITOR=code --waitTo make it permanent, use System Properties > Environment Variables.
$env:EDITOR = "notepad"
# For GUI editors, VS Code, Cursor, VSCodium, Windsurf, Zed, etc.# include --wait$env:EDITOR = "code --wait"To make it permanent, add this to your PowerShell profile.
Popular editor options include:
code- Visual Studio Codecursor- Cursorwindsurf- Windsurfnvim- Neovim editorvim- Vim editornano- Nano editornotepad- Windows Notepadsubl- Sublime Text
Some editors need command-line arguments to run in blocking mode. The --wait flag makes the editor process block until closed.
Configure
You can customize TUI behavior through your OpenCode config file.
{ "$schema": "https://opencode.ai/config.json", "tui": { "scroll_speed": 3, "scroll_acceleration": { "enabled": true } }}Options
scroll_acceleration- Enable macOS-style scroll acceleration for smooth, natural scrolling. When enabled, scroll speed increases with rapid scrolling gestures and stays precise for slower movements. This setting takes precedence overscroll_speedand overrides it when enabled.scroll_speed- Controls how fast the TUI scrolls when using scroll commands (minimum:1). Defaults to3. Note: This is ignored ifscroll_acceleration.enabledis set totrue.
Customization
You can customize various aspects of the TUI view using the command palette (ctrl+x h or /help). These settings persist across restarts.
Username display
Toggle whether your username appears in chat messages. Access this through:
- Command palette: Search for “username” or “hide username”
- The setting persists automatically and will be remembered across TUI sessions