r/opencode • • 23d ago

I added Claude Code's double-Escape message history to opencode (plugin, no fork)

Post image
2 Upvotes

4 comments sorted by

1

u/BalloonWheelie 23d ago

opencode V2 already ships the Timeline dialog — the searchable list of prompts you sent, select → Revert/Copy. It's just bound to /timeline and Ctrl+X g, with no gesture. Claude Code uses double-Escape for message history, so I wrote a small plugin that adds exactly that — and nothing else.

  • Strictly additive: it listens on opencode's raw key stream (the keymap also reads it, so listening doesn't consume the key). A single Escape still interrupts a running turn as before; only a second press within 800 ms opens the Timeline.
  • No fork, no patch: it dispatches opencode's own session.timeline, so the dialog and Revert/Copy stay upstream's.
  • Two files — tui.ts for the gesture, plus a no-op index.ts because a plugin directory is a target for both the TUI and server loaders.

Install (add to cli.json — TUI-only, not opencode.json):

{ "plugins": ["opencode-double-esc-timeline"] }

Repo: https://github.com/ZacxDev/opencode-double-esc-timeline

Known caveat: two quick Escapes to interrupt a running turn also open the Timeline (the interrupt still fires; dismiss with one more Escape).

Here it is firing (animated): https://i.imgur.com/GGZwHuM.gif

Written by me (@ZacxDev); AI coding agents wrote most of the code.

1

u/mejtech 23d ago

what did you do to your terminal

1

u/BalloonWheelie 23d ago

It's a vhs recording of a real session — the font fell back to one with the wrong metrics, hence the spacing. No terminal tweaks: the plugin is just double-Escape -> the timeline.