Files
anomalyco_opencode/packages/www/content/docs/cli/config.mdx
T

166 lines
5.1 KiB
Plaintext

---
title: "Config"
---
Most settings can also be changed from the OpenCode TUI. Press `Ctrl+P`, then select **Open settings**.
<img src={`${import.meta.env.BASE_URL}assets/docs/cli/settings.png`} alt="OpenCode TUI settings dialog" />
The default CLI config location is:
```text
~/.config/opencode/cli.json
```
Set `$XDG_CONFIG_HOME` to use a different config directory:
```text
$XDG_CONFIG_HOME/opencode/cli.json
```
## Theme
Set the theme and color mode:
```json title="cli.json"
{
"theme": {
"name": "tokyonight",
"mode": "system"
}
}
```
| Field | Values | Description |
| ------ | ---------------------------- | ----------------------------------------------------------------- |
| `name` | string | Selects the theme. |
| `mode` | `system`, `dark`, or `light` | Selects the color mode. `system` follows the terminal appearance. |
See [Theme](/cli/theme) for theme configuration.
## Keybinds
Override bindings with the top-level `keybinds` object:
```json title="cli.json"
{
"keybinds": {
"leader": "ctrl+x",
"app.exit": "ctrl+c,ctrl+d,<leader>q",
"app.debug": "none",
"help.show": false
},
"leader": {
"timeout": 2000
}
}
```
See [Keybinds](/cli/keybinds) for every available binding.
## Plugins
Load terminal plugins in order:
```json title="cli.json"
{
"plugins": [
"-opencode.notifications",
{
"package": "./plugins/status.ts",
"options": {
"compact": true
}
}
]
}
```
See [Plugins](/cli/plugins) for packages, local files, options, and enablement directives.
## Scroll
Set scroll speed and acceleration:
```json title="cli.json"
{
"scroll": {
"speed": 2,
"acceleration": true
}
}
```
| Field | Values | Description |
| -------------- | ------------------------ | --------------------------------- |
| `speed` | number, at least `0.001` | Sets the distance per input tick. |
| `acceleration` | boolean | Speeds up repeated scrolling. |
## Attention
Configure notifications and sounds:
```json title="cli.json"
{
"attention": {
"enabled": true,
"notifications": true,
"sound": true,
"volume": 0.4,
"sound_pack": "opencode.default",
"sounds": {
"permission": "/home/me/sounds/permission.wav"
}
}
}
```
| Field | Values | Description |
| --------------- | ---------------------- | ---------------------------------------------------------------------------------------------------- |
| `enabled` | boolean | Enables attention alerts. |
| `notifications` | boolean | Shows system notifications. |
| `sound` | boolean | Plays attention sounds. |
| `volume` | number from `0` to `1` | Sets sound volume. |
| `sound_pack` | string | Selects the active sound pack. |
| `sounds` | object | Overrides files for `default`, `question`, `permission`, `error`, `done`, or `subagent_done` events. |
## Diffs
Configure diff presentation:
```json title="cli.json"
{
"diffs": {
"wrap": "word",
"tree": true,
"single": false,
"view": "auto"
}
}
```
| Field | Values | Description |
| -------- | ----------------------------- | ------------------------------------------------------------- |
| `wrap` | `word` or `none` | Sets line wrapping. |
| `tree` | boolean | Shows the diff file tree. |
| `single` | boolean | Shows only the selected file patch. |
| `view` | `auto`, `split`, or `unified` | Sets the layout. `auto` chooses based on the available width. |
## Terminal
Configure terminal integration:
```json title="cli.json"
{
"terminal": {
"title": true,
"copy": "select"
}
}
```
| Field | Values | Description |
| ------- | -------------------- | -------------------------------------------------------------------------------------------------------- |
| `title` | boolean | Updates the terminal window title. |
| `copy` | `manual` or `select` | Sets manual copy or copy on selection. Defaults to `select` on macOS and Linux, and `manual` on Windows. |