키바인드
키바인드를 커스터마이즈하세요.
OpenCode에는 tui.json을 통해 커스터마이즈할 수 있는 키바인드 목록이 있습니다.
{
"$schema": "https://opencode.ai/tui.json",
"leader_timeout": 2000,
"keybinds": {
"leader": "ctrl+x",
"app_exit": "ctrl+c,ctrl+d,<leader>q",
"app_debug": "none",
"app_console": "none",
"app_heap_snapshot": "none",
"app_toggle_animations": "none",
"app_toggle_file_context": "none",
"app_toggle_diffwrap": "none",
"app_toggle_paste_summary": "none",
"app_toggle_session_directory_filter": "none",
"command_list": "ctrl+p",
"help_show": "none",
"docs_open": "none",
"editor_open": "<leader>e",
"theme_list": "<leader>t",
"theme_switch_mode": "none",
"theme_mode_lock": "none",
"sidebar_toggle": "<leader>b",
"scrollbar_toggle": "none",
"status_view": "<leader>s",
"session_export": "<leader>x",
"session_copy": "none",
"session_new": "<leader>n",
"session_list": "<leader>l",
"session_timeline": "<leader>g",
"session_fork": "none",
"session_rename": "ctrl+r",
"session_delete": "ctrl+d",
"session_share": "none",
"session_unshare": "none",
"session_interrupt": "escape",
"session_compact": "<leader>c",
"session_toggle_timestamps": "none",
"session_toggle_generic_tool_output": "none",
"session_child_first": "<leader>down",
"session_child_cycle": "right",
"session_child_cycle_reverse": "left",
"session_parent": "up",
"stash_delete": "ctrl+d",
"model_provider_list": "ctrl+a",
"model_favorite_toggle": "ctrl+f",
"model_list": "<leader>m",
"model_cycle_recent": "f2",
"model_cycle_recent_reverse": "shift+f2",
"model_cycle_favorite": "none",
"model_cycle_favorite_reverse": "none",
"mcp_list": "none",
"provider_connect": "none",
"console_org_switch": "none",
"agent_list": "<leader>a",
"agent_cycle": "tab",
"agent_cycle_reverse": "shift+tab",
"variant_cycle": "ctrl+t",
"variant_list": "none",
"messages_page_up": "pageup,ctrl+alt+b",
"messages_page_down": "pagedown,ctrl+alt+f",
"messages_line_up": "ctrl+alt+y",
"messages_line_down": "ctrl+alt+e",
"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_next": "none",
"messages_previous": "none",
"messages_last_user": "none",
"messages_copy": "<leader>y",
"messages_undo": "<leader>u",
"messages_redo": "<leader>r",
"messages_toggle_conceal": "<leader>h",
"tool_details": "none",
"display_thinking": "none",
"prompt_submit": "none",
"prompt_editor_context_clear": "none",
"prompt_skills": "none",
"prompt_stash": "none",
"prompt_stash_pop": "none",
"prompt_stash_list": "none",
"workspace_set": "none",
"input_clear": "ctrl+c",
"input_paste": {
"key": "ctrl+v",
"preventDefault": false
},
"input_submit": "return",
"input_newline": "shift+return,ctrl+return,alt+return,ctrl+j",
"input_move_left": "left,ctrl+b",
"input_move_right": "right,ctrl+f",
"input_move_up": "up",
"input_move_down": "down",
"input_select_left": "shift+left",
"input_select_right": "shift+right",
"input_select_up": "shift+up",
"input_select_down": "shift+down",
"input_line_home": "ctrl+a",
"input_line_end": "ctrl+e",
"input_select_line_home": "ctrl+shift+a",
"input_select_line_end": "ctrl+shift+e",
"input_visual_line_home": "alt+a",
"input_visual_line_end": "alt+e",
"input_select_visual_line_home": "alt+shift+a",
"input_select_visual_line_end": "alt+shift+e",
"input_buffer_home": "home",
"input_buffer_end": "end",
"input_select_buffer_home": "shift+home",
"input_select_buffer_end": "shift+end",
"input_delete_line": "ctrl+shift+d",
"input_delete_to_line_end": "ctrl+k",
"input_delete_to_line_start": "ctrl+u",
"input_backspace": "backspace,shift+backspace",
"input_delete": "ctrl+d,delete,shift+delete",
"input_undo": "ctrl+-,super+z",
"input_redo": "ctrl+.,super+shift+z",
"input_word_forward": "alt+f,alt+right,ctrl+right",
"input_word_backward": "alt+b,alt+left,ctrl+left",
"input_select_word_forward": "alt+shift+f,alt+shift+right",
"input_select_word_backward": "alt+shift+b,alt+shift+left",
"input_delete_word_forward": "alt+d,alt+delete,ctrl+delete",
"input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace",
"input_select_all": "super+a",
"history_previous": "up",
"history_next": "down",
"dialog.select.prev": "up,ctrl+p",
"dialog.select.next": "down,ctrl+n",
"dialog.select.page_up": "pageup",
"dialog.select.page_down": "pagedown",
"dialog.select.home": "home",
"dialog.select.end": "end",
"dialog.select.submit": "return",
"dialog.prompt.submit": "return",
"dialog.mcp.toggle": "space",
"prompt.autocomplete.prev": "up,ctrl+p",
"prompt.autocomplete.next": "down,ctrl+n",
"prompt.autocomplete.hide": "escape",
"prompt.autocomplete.select": "return",
"prompt.autocomplete.complete": "tab",
"permission.prompt.fullscreen": "ctrl+f",
"plugins.toggle": "space",
"dialog.plugins.install": "shift+i",
"terminal_suspend": "ctrl+z",
"terminal_title_toggle": "none",
"tips_toggle": "<leader>h",
"plugin_manager": "none",
"plugin_install": "none",
"which_key_toggle": "ctrl+alt+k",
"which_key_layout_toggle": "ctrl+alt+shift+k",
"which_key_pending_toggle": "ctrl+alt+shift+p",
"which_key_group_previous": "ctrl+alt+left,ctrl+alt+[",
"which_key_group_next": "ctrl+alt+right,ctrl+alt+]",
"which_key_scroll_up": "ctrl+alt+up,ctrl+alt+p",
"which_key_scroll_down": "ctrl+alt+down,ctrl+alt+n",
"which_key_page_up": "ctrl+alt+pageup",
"which_key_page_down": "ctrl+alt+pagedown",
"which_key_home": "ctrl+alt+home",
"which_key_end": "ctrl+alt+end"
}
}Note: Windows에서는
input_undo와terminal_suspend의 기본값이 다릅니다:
input_undo는 명시적으로 설정되지 않은 경우ctrl+z,ctrl+-,super+z가 기본값입니다. Windows 터미널이 POSIX suspend를 지원하지 않으므로ctrl+z바인딩이 추가됩니다.terminal_suspend는 네이티브 Windows 터미널이 POSIX suspend를 지원하지 않으므로none으로 강제됩니다.
리더 키
OpenCode는 많은 키바인드에 leader 키를 사용합니다. 이는 터미널에서의 충돌을 방지합니다.
기본적으로 ctrl+x가 리더 키이며, 많은 액션은 먼저 리더 키를 누른 다음 단축키를 눌러야 합니다. 예를 들어, 새 세션을 시작하려면 먼저 ctrl+x를 누른 다음 n을 누릅니다.
키바인드에 리더 키를 반드시 사용할 필요는 없지만, 사용하는 것을 권장합니다.
일부 탐색 키바인드는 기본적으로 의도적으로 리더 키를 사용하지 않습니다. 서브에이전트 세션의 경우, 기본값은 session_child_first = <leader>down, session_child_cycle = right, session_child_cycle_reverse = left, session_parent = up입니다.
leader_timeout은 리더 키 다음 키를 OpenCode가 얼마나 기다릴지 제어합니다. 기본값은 2000 밀리초입니다.
바인딩 값
문자열에는 하나의 단축키 또는 쉼표로 구분된 여러 단축키를 포함할 수 있습니다. 여러 단축키에는 배열을 사용할 수도 있습니다.
고급 사례의 경우, key, event, preventDefault, fallthrough가 있는 객체를 사용하세요.
{
"$schema": "https://opencode.ai/tui.json",
"keybinds": {
"messages_copy": ["<leader>y", "ctrl+shift+c"],
"input_paste": {
"key": "ctrl+v",
"preventDefault": false
}
}
}키바인드 비활성화
tui.json에 키를 "none" 또는 false 값으로 추가하여 키바인드를 비활성화할 수 있습니다.
{
"$schema": "https://opencode.ai/tui.json",
"keybinds": {
"session_compact": "none"
}
}데스크톱 프롬프트 단축키
OpenCode 데스크톱 앱의 프롬프트 입력은 텍스트 편집을 위한 일반적인 Readline/Emacs 스타일 단축키를 지원합니다. 이들은 내장되어 있으며 현재 opencode.json을 통해 설정할 수 없습니다.
| 단축키 | 액션 |
|---|---|
ctrl+a | 현재 줄의 시작으로 이동 |
ctrl+e | 현재 줄의 끝으로 이동 |
ctrl+b | 커서를 한 문자 뒤로 이동 |
ctrl+f | 커서를 한 문자 앞으로 이동 |
alt+b | 커서를 한 단어 뒤로 이동 |
alt+f | 커서를 한 단어 앞으로 이동 |
ctrl+d | 커서 위치의 문자 삭제 |
ctrl+k | 줄 끝까지 삭제 |
ctrl+u | 줄 시작까지 삭제 |
ctrl+w | 이전 단어 삭제 |
alt+d | 다음 단어 삭제 |
ctrl+t | 문자 위치 바꾸기 |
ctrl+g | 팝오버 취소 / 실행 중인 응답 중단 |
Shift+Enter
일부 터미널은 기본적으로 Enter와 함께 수정 키를 보내지 않습니다. Shift+Enter를 이스케이프 시퀀스로 보내도록 터미널을 설정해야 할 수 있습니다.
Windows Terminal
다음 위치에서 settings.json을 엽니다:
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json루트 레벨의 actions 배열에 다음을 추가하세요:
"actions": [
{
"command": {
"action": "sendInput",
"input": "\u001b[13;2u"
},
"id": "User.sendInput.ShiftEnterCustom"
}
]루트 레벨의 keybindings 배열에 다음을 추가하세요:
"keybindings": [
{
"keys": "shift+enter",
"id": "User.sendInput.ShiftEnterCustom"
}
]파일을 저장하고 Windows Terminal을 재시작하거나 새 탭을 엽니다.