Repository navigation
Keybinds without leader key #435
Copy link
Copy link
Closed
Description
Problem
Configuring any keybinds without setting the leader key panics the app. All other not-set keybinds seem to merge with default config.
Example
Adding this to ~/.config/opencode/config.json and trying to run opencode casues the following error:
{
"$schema": "https://opencode.ai/config.json",
"keybinds": {
"messages_page_up": "ctrl+alt+pgup",
"messages_page_down": "ctrl+alt+pgdown",
"messages_half_page_up": "pgup",
"messages_half_page_down": "pgdown",
"app_exit": "<leader>q,ctrl+q"
}
}Caught panic:
runtime error: invalid memory address or nil pointer dereference
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea/v2.(*Program).recoverFromPanic(0xc000670000, {0xbf4c40, 0x156ab30})
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:1134 +0xc5
github.com/charmbracelet/bubbletea/v2.(*Program).Run.func2()
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:871 +0xe8
panic({0xbf4c40?, 0x156ab30?})
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/panic.go:792 +0x132
github.com/sst/opencode/internal/components/commands.(*commandsComponent).View(0xc0006526f0)
/home/runner/work/opencode/opencode/packages/tui/internal/components/commands/commands.go:131 +0x1aca
github.com/sst/opencode/internal/components/chat.(*messagesComponent).home(0xc00046d508)
/home/runner/work/opencode/opencode/packages/tui/internal/components/chat/messages.go:356 +0x8c5
github.com/sst/opencode/internal/components/chat.(*messagesComponent).View(0xc000ca5a10?)
/home/runner/work/opencode/opencode/packages/tui/internal/components/chat/messages.go:291 +0x1d9
github.com/sst/opencode/internal/layout.(*container).View(0xc00027eb40)
/home/runner/work/opencode/opencode/packages/tui/internal/layout/container.go:102 +0xaf2
github.com/sst/opencode/internal/layout.(*flexLayout).View(0xc000349e50)
/home/runner/work/opencode/opencode/packages/tui/internal/layout/flex.go:80 +0x4d4
github.com/sst/opencode/internal/tui.appModel.View({0x0, 0x0, 0xc00044c1c0, {0x0, 0x0}, {0x102af88, 0xc0006660a0}, {0x10318e0, 0xc000668008}, {0x102fe48, ...}, ...})
/home/runner/work/opencode/opencode/packages/tui/internal/tui/tui.go:401 +0x30
github.com/charmbracelet/bubbletea/v2.(*Program).render(0xc000670000, {0x1028f38?, 0xc00066e000?})
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:795 +0x11e
github.com/charmbracelet/bubbletea/v2.(*Program).Run(0xc000670000)
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:1013 +0xe09
main.main()
/home/runner/work/opencode/opencode/packages/tui/cmd/opencode/main.go:94 +0x945
Current Workaround
To avoid this panic a leader key needs to be set like this:
{
"$schema": "https://opencode.ai/config.json",
"keybinds": {
"leader": "ctrl+space",
"messages_page_up": "ctrl+alt+pgup",
"messages_page_down": "ctrl+alt+pgdown",
"messages_half_page_up": "pgup",
"messages_half_page_down": "pgdown",
"app_exit": "<leader>q,ctrl+q"
}
}Default ctrl+x mapping (or anything else like ctrl+space) is fine, but the key must be present. Again, other keybinds seem to be merged with defaults if not specifically set (which, imho, is good).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
rekram1-node commentedon Dec 28, 2025
[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!