-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: allow ctrl+d to exit the app (v0) #3594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v0
Are you sure you want to change the base?
Conversation
| .describe("Leader key for keybind combinations"), | ||
| app_help: z.string().optional().default("<leader>h").describe("Show help dialog"), | ||
| app_exit: z.string().optional().default("ctrl+c,<leader>q").describe("Exit the application"), | ||
| app_exit: z.string().optional().default("ctrl+d,ctrl+c,<leader>q").describe("Exit the application"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated all locations the exit commands are enumerated
00e992e to
6a02b7f
Compare
|
Is this still draft or is it ready for review? |
6a02b7f to
bc8f1ed
Compare
Still draft. Finishing testing changes from our talk in the thread. |
| Description: "exit the app", | ||
| Keybindings: parseBindings("ctrl+c", "<leader>q"), | ||
| // NOTE: ctrl+c requires a double press to exit while ctrl+d requires a single press | ||
| Keybindings: parseBindings("ctrl+c", "ctrl+d", "<leader>q"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
|
|
||
| // 9. Handle exit key debounce for app exit when using non-leader command | ||
| if exitCommand.Matches(msg, a.app.IsLeaderSequence) && keyString != "ctrl+d" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided a separate block was cleanest. exitCommand is now defined here and used in this block and just below.
| } | ||
| // Skip ctrl+d immediate exit key if the editor has content. Allow editor update commands to handle it as forward delete. | ||
| if exitCommand.Matches(msg, a.app.IsLeaderSequence) && keyString == "ctrl+d" && a.editor.Length() > 0 { | ||
| return a, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows the later fall through on next cycle into step 12 further below.
|
@rekram1-node whenever you have time, it's out of draft. Tests for Go and TS passed locally. I'm going to look at the |
bc8f1ed to
695355f
Compare
|
anddd the opentui version just shipped I would've said something if I knew it was shipping today I can still merge this into old branch tho since we are keeping v0 alive for time being |
RIP. Okay. Before putting time into the |
|
U can go ahead! |
This adds support for ctrl+d to exit the app. It follows the unix convention of only requiring a single press of the command. Additionally, it updates the help menu to reflect the new keybind.
695355f to
913a0fb
Compare
|
@rekram1-node rebased to point this branch at |
|
amazin |

Problem
Pressing
ctrl+dshould terminate OpenCode. Claude Code and Codex support similar behavior (Claude Code with two presses, Codex with one), and Unix tools typically require one press to exit programs as well.See #3025 for more details of the problem statement.
Solution
I opted to roll this new functionality into the existing
AppExitCommandcode. I added a separate block to control the newctrl+dapp exit (on single press) but also preserved the existing forward delete functionality when the text editor has content in it.I also updated all locations I could find with the new keybinding information, including where it's displayed for
/help.Testing
Below is videos showing testing on all major platforms.
Screen.Recording.2025-10-31.at.11.27.15.AM.mov
Screen.Recording.2025-10-31.at.11.44.51.AM.mov
Screencast.from.2025-10-31.14-30-01.webm