Skip to content

opencode does not exit on ^D #3025

Closed
Closed

Description

@agladysh

Pressing CTRL+D (EOF) twice should terminate opencode. Claude and Codex support this idiomatic behavior.

Activity

  1. github-actions commented on Oct 8, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • Provide means to disable Ctrl-C #2999: [Provide means to disable Ctrl-C] - This issue discusses the related problem of Ctrl+C behavior and mentions that applications should support proper exit behavior with common key combinations

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Oct 8, 2025

    @rekram1-node
    Collaborator

    makes sense

  3. jdanbrown commented on Oct 29, 2025

    @jdanbrown
    Contributor

    Can we also add an option that allows pressing ctrl+d once instead of twice?

    • claude requires ctrl+d twice
    • codex only requires ctrl+d once
    • Most other unix tools only require ctrl+d once
  4. rekram1-node commented on Oct 29, 2025

    @rekram1-node
    Collaborator

    in the opentui rewrite we are making it exit on first ctrl+c so making it exit on first ctrl+d makes sense too

  5. nwthomas commented on Oct 30, 2025

    @nwthomas
    Contributor

    Hey all, I'm interested in helping out. The contributing guidelines say to make a comment indicating interest.

    I see this issue is assigned, but also that help-wanted label was added 3 days ago. I'd love to work on it if it's available. I currently have MacOS, Windows, and Linux (Ubuntu) setups to test the fix on.

  6. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Collaborator

    Sure @nwthomas we would love that

  7. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Collaborator

    You can add it to the existing go codebase probably pretty easily, or if you prefer you can make a PR against the opentui branch (which is our WIP rewrite) < if u dont wanna add it here Ill just port the go code over for u

    Up to you, or you can do both haha

    If you need any guidance lmk here, or ping me on X or discord

  8. nwthomas commented on Oct 30, 2025

    @nwthomas
    Contributor

    Thank you! I'm looking to get my feet wet and contribute more, so let me start with the Go codebase and then flip to finish in opentui. Does that work?

    It looks like the consensus is one ^D to quit as that's also what you're moving to with ^C (I'm assuming in the rewrite) and parallels other unix tools?

    I'll join the discord as soon as I can.

  9. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Collaborator

    @nwthomas yep, that sounds good to me

  10. nwthomas commented on Oct 31, 2025

    @nwthomas
    Contributor

    I have a draft PR up for the fix in this repo (see just above this comment). However, I've run into a bit of a snag and need clarification. In both opencode and opentui, the Textarea components use ctrl+d to do delete actions (see opencode and opentui).

    We could decide on an alternative keybinding for the existing Textarea functionality.

    However, Claude Code, for instance, only allows quitting via pressing ctrl+d twice if the text box is empty. All other times, it forward deletes text content in the Textarea as well. I'd assume that's what we want to. However, it's not my codebase so I'll defer to you all.

  11. rekram1-node commented on Oct 31, 2025

    @rekram1-node
    Collaborator

    @nwthomas I think ctrl+d only exits app if the prompt input box is empty in other tools like claude, codex, etc

  12. nwthomas commented on Oct 31, 2025

    @nwthomas
    Contributor

    Yeah, exactly. Assuming that's what you all want here too, I can have that up soon.

  13. rekram1-node commented on Oct 31, 2025

    @rekram1-node
    Collaborator

    @nwthomas

    Im sleepy and didn't read ur whole message my bad!

    Yes ur proposal makes total sense, let's be consistent with other tools here

  14. nwthomas commented on Oct 31, 2025

    @nwthomas
    Contributor

    My comment made it sound like I was proposing a different keybinding. All good.

  15. nwthomas commented on Oct 31, 2025

    @nwthomas
    Contributor

    @rekram1-node both v0 and new OpenTUI PRs are ready for review:

    1. v0
    2. OpenTUI
  16. alanxoc3 commented on Oct 31, 2025

    @alanxoc3

    I might not have the popular opinion here. But I'd rather "ctrl+d" be equivalent to "page down" and "ctrl+u" be equivalent to "page up".

    Vim, less, and kak (my editor). And pretty sure a lot more things work that way.

    It makes you not have to reach for the mouse or arrow keys as much.

  17. rekram1-node commented on Oct 31, 2025

    @rekram1-node
    Collaborator

    @alanxoc3 we will have vim motions in the prompt input box, I think when that lands if you are in vim mode would be appropriate

  18. goniz commented on Nov 22, 2025

    @goniz
    Contributor

    Shouldn’t this issue have been closed by #3636 ?
    @adamdotdevin @rekram1-node

  19. rekram1-node commented on Nov 22, 2025

    @rekram1-node
    Collaborator

    yup good callout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions