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

    Clear Session Keybind

    opencode-clear-session-keybind·v0.1.0·工具与命令

    Configure a keyboard shortcut for OpenCode 2's /clear command.

    GitHub 星标

    0

    月装机量

    140

    近 7 天 140

    综合评分

    33.2

    生态多维模型

    最近提交

    3 天前

    2026-10-01

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-clear-session-keybind@0.1.0"]
    }

    OpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    A configurable keyboard shortcut for OpenCode V2's built-in /clear command. It closes the current session tab and returns to a fresh prompt, keeping your selected agent and model. The saved session is not deleted.

    Installation

    Requires the OpenCode V2 CLI. Add this to your cli.json to use leader+C. Disabling the default compaction shortcut frees that key:

    {
      "$schema": "https://opencode.ai/v2/cli.json",
      "keybinds": {
        "session.compact": "none"
      },
      "plugins": [
        {
          "options": {
            "keybind": "<leader>c"
          },
          "package": "opencode-clear-session-keybind"
        }
      ]
    }
    

    Configuration

    options.keybind is required and has no default. Set it to a non-empty shortcut string supported by OpenCode, such as <leader>c or ctrl+l. If you choose a different shortcut, you can keep OpenCode's compaction binding.

    Configure the shortcut through the plugin's options. OpenCode does not accept session.clear under keybinds.

    License

    MIT

    同类生态推荐