feat: bind vim-style line-by-line scrolling (#8980)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Nathan Flurry
2026-01-17 19:54:26 -08:00
committed by GitHub
parent 052f887a9a
commit bfb8c531c2
8 changed files with 66 additions and 6 deletions

View File

@@ -16,6 +16,8 @@ export const TuiEvent = {
"session.compact",
"session.page.up",
"session.page.down",
"session.line.up",
"session.line.down",
"session.half.page.up",
"session.half.page.down",
"session.first",

View File

@@ -601,6 +601,28 @@ export function Session() {
dialog.clear()
},
},
{
title: "Line up",
value: "session.line.up",
keybind: "messages_line_up",
category: "Session",
disabled: true,
onSelect: (dialog) => {
scroll.scrollBy(-1)
dialog.clear()
},
},
{
title: "Line down",
value: "session.line.down",
keybind: "messages_line_down",
category: "Session",
disabled: true,
onSelect: (dialog) => {
scroll.scrollBy(1)
dialog.clear()
},
},
{
title: "Half page up",
value: "session.half.page.up",

View File

@@ -651,8 +651,14 @@ export namespace Config {
session_unshare: z.string().optional().default("none").describe("Unshare current session"),
session_interrupt: z.string().optional().default("escape").describe("Interrupt current session"),
session_compact: z.string().optional().default("<leader>c").describe("Compact the session"),
messages_page_up: z.string().optional().default("pageup").describe("Scroll messages up by one page"),
messages_page_down: z.string().optional().default("pagedown").describe("Scroll messages down by one page"),
messages_page_up: z.string().optional().default("pageup,ctrl+alt+b").describe("Scroll messages up by one page"),
messages_page_down: z
.string()
.optional()
.default("pagedown,ctrl+alt+f")
.describe("Scroll messages down by one page"),
messages_line_up: z.string().optional().default("ctrl+alt+y").describe("Scroll messages up by one line"),
messages_line_down: z.string().optional().default("ctrl+alt+e").describe("Scroll messages down by one line"),
messages_half_page_up: z.string().optional().default("ctrl+alt+u").describe("Scroll messages up by half page"),
messages_half_page_down: z
.string()

View File

@@ -275,6 +275,8 @@ export const TuiRoutes = lazy(() =>
session_compact: "session.compact",
messages_page_up: "session.page.up",
messages_page_down: "session.page.down",
messages_line_up: "session.line.up",
messages_line_down: "session.line.down",
messages_half_page_up: "session.half.page.up",
messages_half_page_down: "session.half.page.down",
messages_first: "session.first",

View File

@@ -842,6 +842,14 @@ export type KeybindsConfig = {
* Scroll messages down by one page
*/
messages_page_down?: string
/**
* Scroll messages up by one line
*/
messages_line_up?: string
/**
* Scroll messages down by one line
*/
messages_line_down?: string
/**
* Scroll messages up by half page
*/

View File

@@ -1019,6 +1019,14 @@ export type KeybindsConfig = {
* Scroll messages down by one page
*/
messages_page_down?: string
/**
* Scroll messages up by one line
*/
messages_line_up?: string
/**
* Scroll messages down by one line
*/
messages_line_down?: string
/**
* Scroll messages up by half page
*/

View File

@@ -8282,12 +8282,22 @@
},
"messages_page_up": {
"description": "Scroll messages up by one page",
"default": "pageup",
"default": "pageup,ctrl+alt+b",
"type": "string"
},
"messages_page_down": {
"description": "Scroll messages down by one page",
"default": "pagedown",
"default": "pagedown,ctrl+alt+f",
"type": "string"
},
"messages_line_up": {
"description": "Scroll messages up by one line",
"default": "ctrl+alt+y",
"type": "string"
},
"messages_line_down": {
"description": "Scroll messages down by one line",
"default": "ctrl+alt+e",
"type": "string"
},
"messages_half_page_up": {

View File

@@ -31,8 +31,10 @@ OpenCode has a list of keybinds that you can customize through the OpenCode conf
"session_child_cycle": "<leader>right",
"session_child_cycle_reverse": "<leader>left",
"session_parent": "<leader>up",
"messages_page_up": "pageup",
"messages_page_down": "pagedown",
"messages_page_up": "pageup,ctrl+alt+b",
"messages_page_down": "pagedown,ctrl+alt+f",
"messages_line_up": "ctrl+alt+y",
"messages_line_down": "ctrl+alt+e",
"messages_half_page_up": "ctrl+alt+u",
"messages_half_page_down": "ctrl+alt+d",
"messages_first": "ctrl+g,home",