summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNathan Thomas <[email protected]>2025-10-31 14:27:41 -0700
committerGitHub <[email protected]>2025-10-31 16:27:41 -0500
commite630d680ddfae0ed6e51d54e63c6765b277174a3 (patch)
tree32f447c863de97aba70d9fcba2507bf07b66f997
parent9e392f25a671c220b7eb8927673b42de4575adb6 (diff)
downloadopencode-e630d680ddfae0ed6e51d54e63c6765b277174a3.tar.gz
opencode-e630d680ddfae0ed6e51d54e63c6765b277174a3.zip
feat: allow ctrl+d to exit the app (#3636)
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx11
-rw-r--r--packages/opencode/src/config/config.ts3
-rw-r--r--packages/sdk/js/src/gen/types.gen.ts4
-rw-r--r--packages/web/src/content/docs/keybinds.mdx3
4 files changed, 19 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
index 20015c307..c5a195f3a 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
@@ -530,6 +530,17 @@ export function Prompt(props: PromptProps) {
setStore("extmarkToPartIndex", new Map())
return
}
+ if (keybind.match("input_forward_delete", e) && store.prompt.input !== "") {
+ const cursorOffset = input.cursorOffset
+ if (cursorOffset < input.plainText.length) {
+ const text = input.plainText
+ const newText = text.slice(0, cursorOffset) + text.slice(cursorOffset + 1)
+ input.setText(newText)
+ input.cursorOffset = cursorOffset
+ }
+ e.preventDefault()
+ return
+ }
if (keybind.match("app_exit", e)) {
await exit()
return
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index fec949606..ac1165eab 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -385,7 +385,7 @@ export namespace Config {
.optional()
.default("ctrl+x")
.describe("Leader key for keybind combinations"),
- app_exit: z.string().optional().default("ctrl+c,<leader>q").describe("Exit the application"),
+ app_exit: z.string().optional().default("ctrl+c,ctrl+d,<leader>q").describe("Exit the application"),
editor_open: z.string().optional().default("<leader>e").describe("Open external editor"),
theme_list: z.string().optional().default("<leader>t").describe("List available themes"),
sidebar_toggle: z.string().optional().default("<leader>b").describe("Toggle sidebar"),
@@ -454,6 +454,7 @@ export namespace Config {
agent_cycle: z.string().optional().default("tab").describe("Next agent"),
agent_cycle_reverse: z.string().optional().default("shift+tab").describe("Previous agent"),
input_clear: z.string().optional().default("ctrl+c").describe("Clear input field"),
+ input_forward_delete: z.string().optional().default("ctrl+d").describe("Forward delete"),
input_paste: z.string().optional().default("ctrl+v").describe("Paste from clipboard"),
input_submit: z.string().optional().default("enter").describe("Submit input"),
input_newline: z
diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts
index e4ee9db3f..c4339c316 100644
--- a/packages/sdk/js/src/gen/types.gen.ts
+++ b/packages/sdk/js/src/gen/types.gen.ts
@@ -135,6 +135,10 @@ export type KeybindsConfig = {
*/
input_clear?: string
/**
+ * Forward delete characters in input field
+ */
+ input_forward_delete?: string
+ /**
* Paste from clipboard
*/
input_paste?: string
diff --git a/packages/web/src/content/docs/keybinds.mdx b/packages/web/src/content/docs/keybinds.mdx
index dc47166b4..884dad035 100644
--- a/packages/web/src/content/docs/keybinds.mdx
+++ b/packages/web/src/content/docs/keybinds.mdx
@@ -11,7 +11,7 @@ OpenCode has a list of keybinds that you can customize through the OpenCode conf
"keybinds": {
"leader": "ctrl+x",
"app_help": "<leader>h",
- "app_exit": "ctrl+c,<leader>q",
+ "app_exit": "ctrl+c,ctrl+d,<leader>q",
"editor_open": "<leader>e",
"theme_list": "<leader>t",
"project_init": "<leader>i",
@@ -42,6 +42,7 @@ OpenCode has a list of keybinds that you can customize through the OpenCode conf
"agent_cycle": "tab",
"agent_cycle_reverse": "shift+tab",
"input_clear": "ctrl+c",
+ "input_forward_delete": "ctrl+d",
"input_paste": "ctrl+v",
"input_submit": "enter",
"input_newline": "shift+enter,ctrl+j"