跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    tannerbruhn

    Snap To Bottom

    opencode-snap-to-bottom·v0.1.1·工具与命令

    Terminal-style snap-to-bottom for the opencode transcript

    GitHub 星标

    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"]
    }

    OpenCode 启动时会通过内嵌运行时自动加载 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.

    同类生态推荐