Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 261ff41

Browse files
thdxropencode
authored andcommitted
sync
1 parent d0a70cb commit 261ff41

5 files changed

Lines changed: 31 additions & 5 deletions

File tree

packages/opencode/src/cli/cmd/tui/component/dialog-command.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ function init() {
4747
}
4848
}
4949
},
50+
show() {
51+
dialog.replace(() => <DialogCommand options={options()} />)
52+
},
5053
register(cb: () => CommandOption[]) {
5154
const results = createMemo(cb)
5255
setRegistrations((arr) => [results, ...arr])
@@ -90,7 +93,10 @@ function DialogCommand(props: { options: CommandOption[] }) {
9093
return (
9194
<DialogSelect
9295
title="Commands"
93-
options={props.options.map((x) => ({ ...x, footer: x.keybind ? keybind.print(x.keybind) : undefined }))}
96+
options={props.options.map((x) => ({
97+
...x,
98+
footer: x.keybind ? keybind.print(x.keybind) : undefined,
99+
}))}
94100
/>
95101
)
96102
}

packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ export function Autocomplete(props: {
270270
description: "show help",
271271
onSelect: () => command.trigger("help.show"),
272272
},
273+
{
274+
display: "/commands",
275+
description: "show all commands",
276+
onSelect: () => command.show(),
277+
},
273278
)
274279
const max = firstBy(results, [(x) => x.display.length, "desc"])?.display.length
275280
if (!max) return results

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,11 @@ export function Prompt(props: PromptProps) {
563563
if (store.mode === "normal") autocomplete.onKeyDown(e)
564564
if (!autocomplete.visible) {
565565
if (
566-
(e.name === "up" && input.cursorOffset === 0) ||
567-
(e.name === "down" && input.cursorOffset === input.plainText.length)
566+
(keybind.match("history_previous", e) && input.cursorOffset === 0) ||
567+
(keybind.match("history_next", e) &&
568+
input.cursorOffset === input.plainText.length)
568569
) {
569-
const direction = e.name === "up" ? -1 : 1
570+
const direction = keybind.match("history_previous", e) ? -1 : 1
570571
const item = history.move(direction, input.plainText)
571572

572573
if (item) {

packages/opencode/src/config/config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,11 @@ export namespace Config {
385385
.optional()
386386
.default("ctrl+x")
387387
.describe("Leader key for keybind combinations"),
388-
app_exit: z.string().optional().default("ctrl+c,ctrl+d,<leader>q").describe("Exit the application"),
388+
app_exit: z
389+
.string()
390+
.optional()
391+
.default("ctrl+c,ctrl+d,<leader>q")
392+
.describe("Exit the application"),
389393
editor_open: z.string().optional().default("<leader>e").describe("Open external editor"),
390394
theme_list: z.string().optional().default("<leader>t").describe("List available themes"),
391395
sidebar_toggle: z.string().optional().default("<leader>b").describe("Toggle sidebar"),
@@ -462,6 +466,8 @@ export namespace Config {
462466
.optional()
463467
.default("shift+enter,ctrl+j")
464468
.describe("Insert newline in input"),
469+
history_previous: z.string().optional().default("up").describe("Previous history item"),
470+
history_next: z.string().optional().default("down").describe("Previous history item"),
465471
})
466472
.strict()
467473
.meta({

packages/sdk/js/src/gen/types.gen.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ export type KeybindsConfig = {
150150
* Insert newline in input
151151
*/
152152
input_newline?: string
153+
/**
154+
* Previous history item
155+
*/
156+
history_previous?: string
157+
/**
158+
* Previous history item
159+
*/
160+
history_next?: string
153161
}
154162

155163
export type AgentConfig = {

0 commit comments

Comments
 (0)