AI & ML
Preventing Accidental OpenCode Exits with Ctrl+C
loach Dev.to (EN Zone)
21 views
OpenCode is powerful, but one default behavior kept getting in my way: pressing Ctrl + C could close the application itself.
If you spend a lot of time in terminals, Ctrl + C is muscle memory. You press it to interrupt a command, stop a long-running process, or simply because your hands move before you think.
Losing the whole OpenCode session because of that is frustrating.
The fix is simple: move the application exit action to a different keybinding.
Change the exit keybinding
Open your OpenCode configuration file and customize the keybindings.
For example:
{
"keybinds": {
"app_exit": "ctrl+d,<leader>q"
}
}
With this configuration, Ctrl + C is no longer the application-exit shortcut.
You can then use Ctrl + D or the leader-based shortcut to exit intentionally.
Why this small change matters
AI coding agents often stay open for long sessions with valuable context.
A keybinding that is common for interruption in terminal workflows should not unexpectedly destroy that session.
Separating "interrupt what is happening" from "close the entire application" makes the interface much harder to use incorrectly.
Closing thoughts
This is a tiny configuration change, but it removed one of the most annoying sources of accidental session loss for me.
If you use OpenCode inside a terminal and frequently hit Ctrl + C out of habit, remapping app_exit is worth doing early.
Read original: https://dev.to/loach2009/preventing-accidental-opencode-exits-with-ctrlc-39dh
← Previous
Is There a Safer Wallet for AI Agents? Here's the Architecture I found that might work.
Next →
7 Best Email MCP Servers and APIs for AI Agents (2026)
Related
OpenClaw Plugin: Connect WAIaaS to LangChain, CrewAI, and Any AI Framework
AI & ML
60
Dev.to (EN Zone)
Why Giving AI Agents More Context Can Make Them Worse
AI & ML
49
Dev.to (EN Zone)
How to Optimize Development Cycles with AI: Numbers, Tools & Tactics [2026]
AI & ML
51
Dev.to (EN Zone)
How to Stop Leaking API Keys and PII to LLMs: Zero-Trust In-Memory Sanitization for Cursor & Claude
AI & ML
49
DEV Community
Comments0
No comments yet — be the first