Snap To Bottom
Terminal-style snap-to-bottom for the opencode transcript
0
264
近 7 天 38
34.8
生态多维模型
8 天前
2026-09-04
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-snap-to-bottom@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-snap-to-bottom@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-snap-to-bottomOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Typing snaps the opencode transcript back to the bottom, the way a terminal treats scrollback.
opencode pins the transcript while output streams and after you submit, but once you scroll up it stays up until you scroll all the way back down. In Claude Code the transcript is the terminal's scrollback, so its behaviour is really the terminal emulator's: any keystroke jumps to the bottom, new output does not, and the scrollback keys never reach the app. This ports that rule.
Install
// ~/.config/opencode/tui.json
{ "plugin": ["opencode-snap-to-bottom"] }
Or from a checkout: { "plugin": ["./path/to/opencode-snap-to-bottom"] }.
Restart opencode afterwards.
Behaviour
Snapping fires on any keystroke except opencode's own scroll and message-navigation
commands (session.page.*, line.*, half.page.*, first, last, message.*,
messages_last_user). It identifies those by recording the dispatched command name from
the keymap dispatch event, so it follows your keybinds — rebind them and it still works.
It does nothing while a dialog is open or in modal/question mode, so the command
palette's filter is never hijacked. Landing exactly on scrollHeight - viewport.height
re-arms opencode's own sticky scroll, so follow-the-output resumes.
Options
{ "plugin": [["opencode-snap-to-bottom", { "trigger": "typing" }]] }
| Option | Default | Meaning |
|---|---|---|
trigger |
"any-key" |
Every keystroke except scroll commands (terminal-faithful). "typing" restricts it to characters actually landing in the prompt. |
paste |
true |
Also snap when pasting into the prompt. |
Verified against opencode 1.18.27
| Case | Result |
|---|---|
| Scroll up, type one character | Snaps to bottom |
| PageUp / PageDown | Still scroll freely |
Home (jump to first message) |
Stays at top |
| Esc, ↑ history recall | Snap |
| Palette open, typing a filter | Transcript stays put |
| Typing while already at bottom | No-op |
Finding the transcript: it is the only scrollbox in the TUI with
stickyScroll && stickyStart === "bottom", which makes that a stable discriminator —
the sidebar, dialogs, autocomplete and diff viewer all have non-sticky scrollboxes.
同类生态推荐
Fold Diffs
opencode-fold-diffs
OpenCode TUI plugin: write, edit, apply_patch and long bash commands render folded to their title line, click or ctrl+o to open them.
Tui
@skwid138/opencode-tui
Configurable TUI plugin for OpenCode — custom logo and prompt placeholders
Double Ctrl C
opencode-double-ctrl-c
OpenCode TUI plugin: press ctrl+c twice to exit, replicating Claude Code and Codex CLI. One press clears the prompt; on an empty prompt it asks for a second press instead of quitting.