opencode/packages/web/src/content/docs/keybinds.mdx

78 lines
2.1 KiB
Plaintext
Raw Normal View History

2025-06-20 04:26:58 +08:00
---
title: Keybinds
2025-07-03 06:44:01 +08:00
description: Customize your keybinds.
2025-06-20 04:26:58 +08:00
---
2025-10-04 01:46:56 +08:00
OpenCode has a list of keybinds that you can customize through the OpenCode config.
2025-06-20 04:26:58 +08:00
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"keybinds": {
"leader": "ctrl+x",
"app_exit": "ctrl+c,ctrl+d,<leader>q",
2025-06-20 04:26:58 +08:00
"editor_open": "<leader>e",
2025-08-15 20:43:30 +08:00
"theme_list": "<leader>t",
"sidebar_toggle": "<leader>b",
"status_view": "<leader>s",
2025-08-15 20:43:30 +08:00
"session_export": "<leader>x",
2025-06-20 04:26:58 +08:00
"session_new": "<leader>n",
"session_list": "<leader>l",
"session_timeline": "<leader>g",
"session_share": "none",
2025-08-15 19:45:20 +08:00
"session_unshare": "none",
"session_interrupt": "escape",
2025-06-20 04:26:58 +08:00
"session_compact": "<leader>c",
"messages_page_up": "pageup",
"messages_page_down": "pagedown",
2025-06-20 04:26:58 +08:00
"messages_half_page_up": "ctrl+alt+u",
"messages_half_page_down": "ctrl+alt+d",
"messages_first": "ctrl+g,home",
"messages_last": "ctrl+alt+g,end",
"messages_copy": "<leader>y",
2025-08-15 19:45:20 +08:00
"messages_undo": "<leader>u",
"messages_redo": "<leader>r",
"messages_toggle_conceal": "<leader>h",
2025-08-15 20:43:30 +08:00
"model_list": "<leader>m",
"model_cycle_recent": "f2",
"model_cycle_recent_reverse": "shift+f2",
"command_list": "ctrl+p",
2025-08-15 20:43:30 +08:00
"agent_list": "<leader>a",
"agent_cycle": "tab",
"agent_cycle_reverse": "shift+tab",
"input_clear": "ctrl+c",
"input_forward_delete": "ctrl+d",
2025-08-15 20:43:30 +08:00
"input_paste": "ctrl+v",
"input_submit": "enter",
"input_newline": "shift+enter,ctrl+j",
"history_previous": "up",
"history_next": "down"
2025-06-20 04:26:58 +08:00
}
}
```
2025-08-08 04:16:12 +08:00
---
2025-06-20 04:26:58 +08:00
## Leader key
2025-10-04 01:46:56 +08:00
OpenCode uses a `leader` key for most keybinds. This avoids conflicts in your terminal.
2025-06-20 04:26:58 +08:00
By default, `ctrl+x` is the leader key and most actions require you to first press the leader key and then the shortcut. For example, to start a new session you first press `ctrl+x` and then press `n`.
You don't need to use a leader key for your keybinds but we recommend doing so.
2025-07-21 22:13:57 +08:00
2025-08-08 04:16:12 +08:00
---
## Disable keybind
2025-07-21 22:13:57 +08:00
You can disable a keybind by adding the key to your config with a value of "none".
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"keybinds": {
2025-08-15 19:45:20 +08:00
"session_compact": "none"
2025-07-21 22:13:57 +08:00
}
}
```