opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: add keybindings reference dialog to TUI

Open frankdierolf opened this issue 1 month ago • 1 comments

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. This makes it harder to learn and use the TUI efficiently.

Solution

I added a simple keybindings reference dialog that displays all available keybindings in one place. The approach was straightforward - the goal was to display keybindings, so I made them displayable. No overthinking, just a practical solution.

What Changed

New Component:

  • Created dialog-keybindings.tsx that lists all keybindings with descriptions
  • Uses the existing DialogSelect component for consistency with other TUI dialogs (models, themes, sessions)
  • Automatically fetches all keybindings from the keybind context
  • Shows them in a searchable/filterable alphabetical list

Configuration:

  • Added keybindings_list config option with default keybinding <leader>? (ctrl+x + ?)
  • Registered in the command palette as "Show keybindings"

Integration:

  • Added import and registration in app.tsx
  • Follows the same pattern as existing dialogs (model list, theme list, etc.)

How to Use

Via Keybinding:

  • Press ctrl+x (leader key), then ?

Via Command Palette:

  • Press ctrl+p
  • Type "keybindings" or "Show keybindings"
  • Hit enter

Implementation Notes

I followed the existing patterns in the codebase:

  • Reused DialogSelect component (same as model/theme lists)
  • Used useKeybind() hook to fetch all keybindings dynamically
  • Kept descriptions in sync with config schema
  • Made it searchable by default (built into DialogSelect)

Simplicity first - just showing what's there, no extra features.

Fixes #3886

frankdierolf avatar Nov 04 '25 11:11 frankdierolf

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.
image image

Best regrads,

Frank :v:

frankdierolf avatar Nov 04 '25 11:11 frankdierolf

Updated to latest dev branch

frankdierolf avatar Nov 10 '25 11:11 frankdierolf