opencode
opencode copied to clipboard
feat: add keybindings reference dialog to TUI
Problem
When using the TUI, there's no easy way to discover what keybindings are available. Users have to check documentation or dig through config files to find out what shortcuts they can use.
Solution
Added a searchable keybindings dialog accessible via <leader>? that displays all 88 keybindings with their descriptions.
What Changed
- Created
dialog-keybindings.tsxusing the existingDialogSelectcomponent - Added
keybindings_listconfig option (default:<leader>?= ctrl+x + ?) - Registered in command palette under "System" category
- Descriptions dynamically extracted from config schema using
zodToJsonSchema
How to Use
Via Keybinding: Press ctrl+x then ?
Via Command Palette: Press ctrl+p, type "keybindings"
Implementation
Follows existing patterns:
- Reuses
DialogSelectcomponent (same as model/theme lists) - Fetches keybindings from
useKeybind()hook - Alphabetically sorted and searchable by default
- Descriptions stay in sync with schema automatically (single source of truth)
Fixes #3886
Hola,
Please take some seconds to review. Thats a feautre which tangles the UX space as, thats why^^
- I throwed in under "System" which seemed reasonable to me:
- And I made the decision for
<leader> + ? - And I ordered the overview alphabetically.
- Only READ
- Didn't test how it will behave with custom keybindings. Should be fine, but don't know.
Best regrads,
Frank :v:
Updated to latest dev branch