कीबाइंड
अपने कीबाइंड कस्टमाइज़ करें।
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होता है।ctrl+zबाइंडिंग इसलिए जोड़ी गई है क्योंकि Windows टर्मिनल POSIX suspend का समर्थन नहीं करते।terminal_suspendकोnoneपर बाध्य किया गया है क्योंकि नेटिव Windows टर्मिनल POSIX suspend का समर्थन नहीं करते।
Leader Key
OpenCode कई कीबाइंड के लिए एक leader कुंजी का उपयोग करता है। यह आपके टर्मिनल में टकराव से बचाता है।
डिफ़ॉल्ट रूप से, ctrl+x leader कुंजी है और कई एक्शन के लिए आपको पहले leader कुंजी और फिर शॉर्टकट दबाना होता है। उदाहरण के लिए, एक नया सत्र शुरू करने के लिए आप पहले ctrl+x दबाते हैं और फिर n दबाते हैं।
आपको अपने कीबाइंड के लिए leader कुंजी का उपयोग करने की आवश्यकता नहीं है लेकिन हम ऐसा करने की अनुशंसा करते हैं।
कुछ नेविगेशन कीबाइंड डिफ़ॉल्ट रूप से जानबूझकर leader कुंजी का उपयोग नहीं करते। सबएजेंट सत्रों के लिए, डिफ़ॉल्ट हैं session_child_first = <leader>down, session_child_cycle = right, session_child_cycle_reverse = left, और session_parent = up।
leader_timeout नियंत्रित करता है कि OpenCode leader कुंजी के बाद अगली कुंजी के लिए कितनी देर प्रतीक्षा करता है। यह डिफ़ॉल्ट रूप से 2000 मिलीसेकंड होता है।
Binding Values
एक स्ट्रिंग में एक शॉर्टकट या कई अल्पविराम-पृथक शॉर्टकट हो सकते हैं। आप कई शॉर्टकट के लिए एक array का भी उपयोग कर सकते हैं।
उन्नत मामलों के लिए, 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"
}
}Desktop Prompt Shortcuts
OpenCode डेस्कटॉप ऐप प्रॉम्प्ट इनपुट टेक्स्ट संपादन के लिए सामान्य Readline/Emacs-शैली के शॉर्टकट का समर्थन करता है। ये बिल्ट-इन हैं और वर्तमान में opencode.json के माध्यम से कॉन्फ़िगर करने योग्य नहीं हैं।
| Shortcut | Action |
|---|---|
ctrl+a | वर्तमान लाइन के आरंभ में जाएँ |
ctrl+e | वर्तमान लाइन के अंत में जाएँ |
ctrl+b | कर्सर को एक कैरेक्टर पीछे ले जाएँ |
ctrl+f | कर्सर को एक कैरेक्टर आगे ले जाएँ |
alt+b | कर्सर को एक शब्द पीछे ले जाएँ |
alt+f | कर्सर को एक शब्द आगे ले जाएँ |
ctrl+d | कर्सर के नीचे कैरेक्टर हटाएँ |
ctrl+k | लाइन के अंत तक kill करें |
ctrl+u | लाइन के आरंभ तक kill करें |
ctrl+w | पिछला शब्द kill करें |
alt+d | अगला शब्द kill करें |
ctrl+t | कैरेक्टर ट्रांसपोज़ करें |
ctrl+g | popover रद्द करें / चल रही प्रतिक्रिया रोकें |
Shift+Enter
कुछ टर्मिनल डिफ़ॉल्ट रूप से Enter के साथ modifier कुंजियाँ नहीं भेजते। आपको अपने टर्मिनल को Shift+Enter को एक escape sequence के रूप में भेजने हेतु कॉन्फ़िगर करने की आवश्यकता हो सकती है।
Windows Terminal
अपनी settings.json यहाँ खोलें:
%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.jsonइसे रूट-स्तर के actions array में जोड़ें:
"actions": [
{
"command": {
"action": "sendInput",
"input": "\u001b[13;2u"
},
"id": "User.sendInput.ShiftEnterCustom"
}
]इसे रूट-स्तर के keybindings array में जोड़ें:
"keybindings": [
{
"keys": "shift+enter",
"id": "User.sendInput.ShiftEnterCustom"
}
]फ़ाइल सहेजें और Windows Terminal पुनः आरंभ करें या एक नया टैब खोलें।