You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[UX] Ctrl+C should not exit OpenCode - conflicts with universal copy shortcut #7957
Pressing Ctrl+C in OpenCode immediately exits the application. This is extremely frustrating because Ctrl+C is the universal copy shortcut on Windows (and commonly used on Linux too).
Users frequently press Ctrl+C out of habit when trying to copy text, and accidentally terminate their entire session - losing context and conversation history.
The Problem
Shortcut
User Expectation
OpenCode Behavior
Ctrl+C
Copy selected text
Exits application
This happens constantly during normal usage:
Copying error messages to search online
Copying code snippets from AI responses
Copying file paths or commands
General muscle memory from every other application
Expected Behavior
Option 1 (Recommended): Require double Ctrl+C or Ctrl+C twice within 1-2 seconds to exit
First Ctrl+C: Show message "Press Ctrl+C again to exit"
Second Ctrl+C: Actually exit
Option 2: Use a different exit shortcut
Ctrl+D (common in Unix terminals for EOF/exit)
Ctrl+Q (quit)
/exit or /quit command only
Option 3: Make Ctrl+C cancel current operation only (like Claude Code)
Same here. I press Ctrl+C out of habit and get kicked out 4-5x a day. New user.
Reacted by Gintas Z., Bart van Heukelom, tsukimizake, XTY, Pavol Pitonak, TheOnlyZipperlein, Kenneth, Johan Larsson, Spliterash and Muhammad Dicky Isra
Workaround till its not default, set the following in opencode.json
"keybinds": {
"app_exit": "ctrl+d,<leader>q"
}
Simply removes ctrl+c from default. HTH
Reacted by leonbuild, Salvatore Zaza, Injamul Islam, dengmingcong, Caleb P. Burns, AbdulMalik Bello, alexey.stogny, Marco Lecheler, Vladimir Rybas, 0x5487 and 5 more
Thanks for the detailed context on the Windows-specific behavior. You're right that on Windows, Ctrl+C can be intercepted at the console level before reaching the TUI keybind handlers in some scenarios.
Good news: There are already PRs open to address this:
Your workaround in the keybinds config does work for most cases:
"keybinds": {
"app_exit": "ctrl+d,<leader>q"
}
The AutoHotkey approach you shared is clever for cases where the signal gets caught at the OS/Bun level before OpenCode can handle it. That said, the config workaround should work for the majority of Windows users.
This issue is being tracked alongside #9041 (detailed implementation spec) and #2999. Will leave this open for visibility until one of the PRs lands.
Thanks for the detailed context on the Windows-specific behavior. You're right that on Windows, Ctrl+C can be intercepted at the console level before reaching the TUI keybind handlers in some scenarios.
Hello, I do not have Windows, copy on mac is CMD + C, but I did accidentally press CTRL+C with the side of my finger because CTRL + X is the gateway to several other features, like subagent list.
Removing CTRL+C as an immediate termination, at least when an action is running, would be a better default. For the moment of course I've edited tui.json
This is happening also on Linux and even with Ctrl+Shift+c which is Konsole shortcut for copy action (and many other terminals), disabling Ctrl+c keybinding in tui.json won't help. Terribly annoying :-(
Is anyone else still paying attention to this issue?
In my opinion (I use SSH to access OpenCode on a remote host), allowing users to clear the input buffer with Ctrl+C when there is content, but having Ctrl+C directly exit the program while a task is being processed, is fundamentally inconsistent.
Old version the keybinds can be put in the opencode.json file. ~/.config/opencode/opencode.json
newer release try put into tui.json. ~/.config/opencode/tui.json
should at least be an are you sure with a way to turn that off its that is what you really want. mid run closed out and lost everything. its a 'stop' command most everywhere else where ctrl-d is the logout in most posix cli's
Crear el archivo tui.json con app_exit deshabilitado:
Podemos crearlo en forma global o solo para el proyecto:
Opción A) Forma Global > Archivo: C:\Users\tu_usuario.config\opencode\tui.json
Si deseas puedes usar el atajo para encontrar la carpeta global opencode , presionas las teclas Windows+R (abre el formulario ejecutar) y alli digitas %USERPROFILE%/.config/opencode/ , se te abrira la carpeta global opencode y creas el archivo tui.json
Opción B) En el Proyecto > ./tui.json , El archivo lo creamos en la raiz del Proyecto.
Contenido del archivo tui.json
{
"$schema": "https://opencode.ai/tui.json",
"keybinds": {
"app_exit": "none"
}
}
Esto deshabilita Ctrl+C como atajo para salir. El valor "none" anula la combinación por defecto (ctrl+c, ctrl+d, q).
Después de crear el archivo, reiniciar opencode para que los cambios tomen efecto.
Activity
github-actions commentedon Jan 12, 2026
This issue might be a duplicate of existing issues. Please check:
For keybind-related issues, please also check our pinned keybinds documentation: #4997
Feel free to ignore if none of these address your specific case.
carljuneau commentedon Jan 15, 2026
Same here. I press Ctrl+C out of habit and get kicked out 4-5x a day. New user.
stefanoallima commentedon Jan 15, 2026
same the experience to copy text is very cumbersome
HustCoderHu commentedon Jan 25, 2026
Same here. If ctrl+d exits, why have ctrl+c too? Plus, ctrl+c is already bound to the 'clear input' function.
shrwnsan commentedon Jan 30, 2026
Workaround till its not default, set the following in
opencode.jsonSimply removes ctrl+c from default. HTH
fix(keybinds): remove ctrl+c from default app_exit keybind to prevent…
mcheiyue commentedon Feb 4, 2026
相同问题确认 (Windows 11 + PowerShell)
环境:
问题描述:
在 Windows Terminal 中使用 OpenCode TUI 时,习惯性使用 复制内容,但每次都会导致 TUI 意外退出。这个操作习惯在 Windows 生态中非常根深蒂固,每天误触多次严重影响使用体验。
已尝试的解决方案:
根本原因:
根据我的调查,OpenCode 使用预编译的 二进制文件,Windows 控制台会直接将 (SIGINT) 广播给所有前台进程,配置文件和包装脚本层面都无法拦截。
临时 Workaround:
目前唯一有效的方案是使用 AutoHotkey 在系统级拦截 Ctrl+C:
请求:
希望能够在配置文件中添加选项彻底禁用 Ctrl+C 退出行为,例如:
{ "tui": { "disableCtrlCExit": true } }这个问题在 Windows 用户中非常普遍(参见 #2999, #10538),强烈建议作为高优先级 UX 改进项。
感谢团队的辛勤工作!期待官方解决方案 🙏
R44VC0RP commentedon Feb 4, 2026
Thanks for the detailed context on the Windows-specific behavior. You're right that on Windows, Ctrl+C can be intercepted at the console level before reaching the TUI keybind handlers in some scenarios.
Good news: There are already PRs open to address this:
ctrl+cfrom the defaultapp_exitkeybind entirely (simplest fix)Your workaround in the keybinds config does work for most cases:
The AutoHotkey approach you shared is clever for cases where the signal gets caught at the OS/Bun level before OpenCode can handle it. That said, the config workaround should work for the majority of Windows users.
This issue is being tracked alongside #9041 (detailed implementation spec) and #2999. Will leave this open for visibility until one of the PRs lands.
lightcomc commentedon Feb 6, 2026
same here
fix(keybinds): remove ctrl+c from default app_exit keybind to prevent…
tagliala commentedon Mar 19, 2026
Hello, I do not have Windows, copy on mac is CMD + C, but I did accidentally press CTRL+C with the side of my finger because CTRL + X is the gateway to several other features, like subagent list.
Removing CTRL+C as an immediate termination, at least when an action is running, would be a better default. For the moment of course I've edited
tui.jsonG10h4ck commentedon Mar 27, 2026
This is happening also on Linux and even with
Ctrl+Shift+cwhich is Konsole shortcut for copy action (and many other terminals), disablingCtrl+ckeybinding intui.jsonwon't help. Terribly annoying :-(Konjac-XZ commentedon Apr 30, 2026
Is anyone else still paying attention to this issue?
In my opinion (I use SSH to access OpenCode on a remote host), allowing users to clear the input buffer with Ctrl+C when there is content, but having Ctrl+C directly exit the program while a task is being processed, is fundamentally inconsistent.
Marcin-Kozyra commentedon May 17, 2026
same....
shiningbridge commentedon Jun 1, 2026
Old version the keybinds can be put in the opencode.json file. ~/.config/opencode/opencode.json
newer release try put into tui.json. ~/.config/opencode/tui.json
trek-e commentedon Jun 22, 2026
should at least be an are you sure with a way to turn that off its that is what you really want. mid run closed out and lost everything. its a 'stop' command most everywhere else where ctrl-d is the logout in most posix cli's
kingtom2016 commentedon Aug 10, 2026
same the experience to copy text is very cumbersome, Hope like claude code, double Ctrl + C to confirm to quit.
osimarr commentedon Aug 16, 2026
Please, do the option 1:
Option 1 (Recommended): Require double Ctrl+C or Ctrl+C twice within 1-2 seconds to exit
First Ctrl+C: Show message "Press Ctrl+C again to exit"
Second Ctrl+C: Actually exit
erfanium commentedon Aug 28, 2026
wrote a small TUI plugin that does the double Ctrl+C thing (first press warns, second exits). Works on Linux/macOS, tested on 1.18.25: gist link:
https://gist.github.com/erfanium/bf00644447d82e53691db4af29428253
alextutor commentedon Sep 4, 2026
https://www.unidadvirtual.com/opencode-cli-deseo-anular-la-combinacion-de-teclas-crl-c
Solucion:
Crear el archivo tui.json con app_exit deshabilitado:
Podemos crearlo en forma global o solo para el proyecto:
Opción A) Forma Global > Archivo: C:\Users\tu_usuario.config\opencode\tui.json
Opción B) En el Proyecto > ./tui.json , El archivo lo creamos en la raiz del Proyecto.
{
"$schema": "https://opencode.ai/tui.json",
"keybinds": {
"app_exit": "none"
}
}
Esto deshabilita Ctrl+C como atajo para salir. El valor "none" anula la combinación por defecto (ctrl+c, ctrl+d, q).
Después de crear el archivo, reiniciar opencode para que los cambios tomen efecto.
neriousy commentedon Oct 1, 2026
Closing as a duplicate of #2999, which tracks Ctrl+C exiting OpenCode. Please add any details and 👍 there.
In OpenCode v2 you can already change this by remapping or disabling the
app.exitkeybind (set it to"none") intui.json.