From 05f335ce621ce9012c257c505f56245831cac1ed Mon Sep 17 00:00:00 2001 From: Victor Navarro Date: Wed, 24 Jun 2026 12:07:23 +0200 Subject: [PATCH] feat(tui): add diff viewer keybind (#33365) --- packages/opencode/test/config/tui.test.ts | 2 ++ packages/tui/src/app.tsx | 1 + packages/tui/src/config/keybind.ts | 2 ++ 3 files changed, 5 insertions(+) diff --git a/packages/opencode/test/config/tui.test.ts b/packages/opencode/test/config/tui.test.ts index 3050467a4..0c96267a2 100644 --- a/packages/opencode/test/config/tui.test.ts +++ b/packages/opencode/test/config/tui.test.ts @@ -472,6 +472,7 @@ it.instance("resolves keybind lookup from canonical keybinds", () => keybinds: { leader: { key: { name: "g", ctrl: true } }, command_list: "alt+p", + diff_open: "ctrl+j", which_key_toggle: "alt+k", editor_open: "ctrl+e", "prompt.autocomplete.next": "ctrl+j", @@ -487,6 +488,7 @@ it.instance("resolves keybind lookup from canonical keybinds", () => expect(config.keybinds.get("leader")?.[0]?.key).toEqual({ name: "g", ctrl: true }) expect(config.leader_timeout).toBe(1234) expect(config.keybinds.get("command.palette.show")?.[0]?.key).toBe("alt+p") + expect(config.keybinds.get("diff.open")?.[0]?.key).toBe("ctrl+j") expect(config.keybinds.get("session.new")?.[0]?.key).toBe("n") expect(config.keybinds.get("which-key.toggle")?.[0]?.key).toBe("alt+k") expect(config.keybinds.get("which-key.layout.toggle")?.[0]?.key).toBe("ctrl+alt+shift+k") diff --git a/packages/tui/src/app.tsx b/packages/tui/src/app.tsx index 39aa35993..57b99c45c 100644 --- a/packages/tui/src/app.tsx +++ b/packages/tui/src/app.tsx @@ -119,6 +119,7 @@ const appBindingCommands = [ "theme.mode.lock", "help.show", "docs.open", + "diff.open", "workspace.list", "app.debug", "app.console", diff --git a/packages/tui/src/config/keybind.ts b/packages/tui/src/config/keybind.ts index bab39083d..c58189552 100644 --- a/packages/tui/src/config/keybind.ts +++ b/packages/tui/src/config/keybind.ts @@ -57,6 +57,7 @@ export const Definitions = { command_list: keybind("ctrl+p", "List available commands"), help_show: keybind("none", "Open help dialog"), docs_open: keybind("none", "Open documentation"), + diff_open: keybind("none", "Open diff viewer"), diff_close: keybind("escape,q", "Close diff viewer"), diff_toggle: keybind("enter,space", "Toggle diff viewer item"), diff_expand: keybind("right", "Expand diff viewer item"), @@ -264,6 +265,7 @@ export const CommandMap = { command_list: "command.palette.show", help_show: "help.show", docs_open: "docs.open", + diff_open: "diff.open", diff_close: "diff.close", diff_toggle: "diff.toggle", diff_expand: "diff.expand",