opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Add keybindable commands to navigate between user messages

Open will-marella opened this issue 3 weeks ago • 7 comments

Closes #5077

Implements configurable keybinds to jump between user messages in chat.

  • Defaults to "none" to avoid keybind collisions
  • Snaps directly to user message boundaries
  • Updated keybinds.mdx documentation

will-marella avatar Dec 04 '25 19:12 will-marella

This is awesome!!

I would add default to <leader>+up and <leader>+down.

dbpolito avatar Dec 04 '25 19:12 dbpolito

intentionally not setting default to avoid issues rn, we can add a default later on. Some keybind stuff is in flux rn

rekram1-node avatar Dec 04 '25 19:12 rekram1-node

/review

rekram1-node avatar Dec 04 '25 19:12 rekram1-node

@will-marella This should probably include a check similar to !part.synthetic && !part.ignored to avoid moving to messages that were actually produced by plugins and not typed by the user. Moving between plugin-produced messages is likely not the behaviour that was intended or that users would expect from these commands.

ariane-emory avatar Dec 04 '25 20:12 ariane-emory

@will-marella This should probably include a check similar to !part.synthetic && !part.ignored to avoid moving to messages that were actually produced by plugins and not typed by the user. Moving between plugin-produced messages is likely not the behaviour that was intended or that users would expect from these commands.

This filter is now added with the same logic as messages_last_user

will-marella avatar Dec 04 '25 21:12 will-marella

/review

rekram1-node avatar Dec 05 '25 05:12 rekram1-node

Rebased on latest dev and addressed all code review feedback:

Typed dialog parameter with ReturnType<typeof useDialog> Used non-mutating reverse with spread operator Refactored to guard clause pattern to deduplicate dialog.clear() while avoiding else per style guide

Note: Pushed with --no-verify due to typecheck errors in upstream packages unrelated to this PR. My changes typecheck cleanly when checked in isolation.

will-marella avatar Dec 05 '25 15:12 will-marella

/review

rekram1-node avatar Dec 22 '25 16:12 rekram1-node

lgtm

github-actions[bot] avatar Dec 22 '25 16:12 github-actions[bot]