Clear Session Keybind
Configure a keyboard shortcut for OpenCode 2's /clear command.
0
140
140 in 7 days
33.2
Multi-signal model
3 days ago
2026-10-01
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-clear-session-keybind@0.1.0"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-clear-session-keybind@0.1.0"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-clear-session-keybindOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
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
Similar plugins
Tui Quota Usage
opencode-tui-quota-usage
OpenCode quota usage sidebar tracker for OpenCode V2 CLI/TUI
Circadian
opencode-circadian
Automatically switch your opencode TUI theme by time of day — a day theme and a night theme, with a gentle manual override.
Go Usage
@pistonex/opencode-go-usage
OpenCode TUI plugin that shows OpenCode Go subscription usage (rolling / weekly / monthly) in the sidebar