keybinds.mdx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ---
  2. title: Keybinds
  3. description: Customize your keybinds.
  4. ---
  5. OpenCode has a list of keybinds that you can customize through the OpenCode config.
  6. ```json title="opencode.json"
  7. {
  8. "$schema": "https://opencode.ai/config.json",
  9. "keybinds": {
  10. "leader": "ctrl+x",
  11. "app_exit": "ctrl+c,ctrl+d,<leader>q",
  12. "editor_open": "<leader>e",
  13. "theme_list": "<leader>t",
  14. "sidebar_toggle": "<leader>b",
  15. "username_toggle": "none",
  16. "status_view": "<leader>s",
  17. "session_export": "<leader>x",
  18. "session_new": "<leader>n",
  19. "session_list": "<leader>l",
  20. "session_timeline": "<leader>g",
  21. "session_share": "none",
  22. "session_unshare": "none",
  23. "session_interrupt": "escape",
  24. "session_compact": "<leader>c",
  25. "session_child_cycle": "<leader>+right",
  26. "session_child_cycle_reverse": "<leader>+left",
  27. "messages_page_up": "pageup",
  28. "messages_page_down": "pagedown",
  29. "messages_half_page_up": "ctrl+alt+u",
  30. "messages_half_page_down": "ctrl+alt+d",
  31. "messages_first": "ctrl+g,home",
  32. "messages_last": "ctrl+alt+g,end",
  33. "messages_copy": "<leader>y",
  34. "messages_undo": "<leader>u",
  35. "messages_redo": "<leader>r",
  36. "messages_last_user": "none",
  37. "messages_toggle_conceal": "<leader>h",
  38. "model_list": "<leader>m",
  39. "model_cycle_recent": "f2",
  40. "model_cycle_recent_reverse": "shift+f2",
  41. "command_list": "ctrl+p",
  42. "agent_list": "<leader>a",
  43. "agent_cycle": "tab",
  44. "agent_cycle_reverse": "shift+tab",
  45. "input_clear": "ctrl+c",
  46. "input_paste": "ctrl+v",
  47. "input_submit": "enter",
  48. "input_newline": "shift+enter,ctrl+j",
  49. "history_previous": "up",
  50. "history_next": "down"
  51. }
  52. }
  53. ```
  54. ---
  55. ## Leader key
  56. OpenCode uses a `leader` key for most keybinds. This avoids conflicts in your terminal.
  57. 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`.
  58. You don't need to use a leader key for your keybinds but we recommend doing so.
  59. ---
  60. ## Disable keybind
  61. You can disable a keybind by adding the key to your config with a value of "none".
  62. ```json title="opencode.json"
  63. {
  64. "$schema": "https://opencode.ai/config.json",
  65. "keybinds": {
  66. "session_compact": "none"
  67. }
  68. }
  69. ```