mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
feat: allow ctrl+d to exit the app (#3636)
This commit is contained in:
@@ -530,6 +530,17 @@ export function Prompt(props: PromptProps) {
|
|||||||
setStore("extmarkToPartIndex", new Map())
|
setStore("extmarkToPartIndex", new Map())
|
||||||
return
|
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)) {
|
if (keybind.match("app_exit", e)) {
|
||||||
await exit()
|
await exit()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ export namespace Config {
|
|||||||
.optional()
|
.optional()
|
||||||
.default("ctrl+x")
|
.default("ctrl+x")
|
||||||
.describe("Leader key for keybind combinations"),
|
.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"),
|
editor_open: z.string().optional().default("<leader>e").describe("Open external editor"),
|
||||||
theme_list: z.string().optional().default("<leader>t").describe("List available themes"),
|
theme_list: z.string().optional().default("<leader>t").describe("List available themes"),
|
||||||
sidebar_toggle: z.string().optional().default("<leader>b").describe("Toggle sidebar"),
|
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: z.string().optional().default("tab").describe("Next agent"),
|
||||||
agent_cycle_reverse: z.string().optional().default("shift+tab").describe("Previous 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_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_paste: z.string().optional().default("ctrl+v").describe("Paste from clipboard"),
|
||||||
input_submit: z.string().optional().default("enter").describe("Submit input"),
|
input_submit: z.string().optional().default("enter").describe("Submit input"),
|
||||||
input_newline: z
|
input_newline: z
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ export type KeybindsConfig = {
|
|||||||
* Clear input field
|
* Clear input field
|
||||||
*/
|
*/
|
||||||
input_clear?: string
|
input_clear?: string
|
||||||
|
/**
|
||||||
|
* Forward delete characters in input field
|
||||||
|
*/
|
||||||
|
input_forward_delete?: string
|
||||||
/**
|
/**
|
||||||
* Paste from clipboard
|
* Paste from clipboard
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ OpenCode has a list of keybinds that you can customize through the OpenCode conf
|
|||||||
"keybinds": {
|
"keybinds": {
|
||||||
"leader": "ctrl+x",
|
"leader": "ctrl+x",
|
||||||
"app_help": "<leader>h",
|
"app_help": "<leader>h",
|
||||||
"app_exit": "ctrl+c,<leader>q",
|
"app_exit": "ctrl+c,ctrl+d,<leader>q",
|
||||||
"editor_open": "<leader>e",
|
"editor_open": "<leader>e",
|
||||||
"theme_list": "<leader>t",
|
"theme_list": "<leader>t",
|
||||||
"project_init": "<leader>i",
|
"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": "tab",
|
||||||
"agent_cycle_reverse": "shift+tab",
|
"agent_cycle_reverse": "shift+tab",
|
||||||
"input_clear": "ctrl+c",
|
"input_clear": "ctrl+c",
|
||||||
|
"input_forward_delete": "ctrl+d",
|
||||||
"input_paste": "ctrl+v",
|
"input_paste": "ctrl+v",
|
||||||
"input_submit": "enter",
|
"input_submit": "enter",
|
||||||
"input_newline": "shift+enter,ctrl+j"
|
"input_newline": "shift+enter,ctrl+j"
|
||||||
|
|||||||
Reference in New Issue
Block a user