General
Using Ctrl+Enter to Submit in OpenCode and Enter for New Lines
0 views

Another OpenCode behavior I wanted to change was message submission.
By default, pressing Enter submits the current prompt. If you are used to chat tools where Enter inserts a new line and Ctrl + Enter sends, this makes accidental submissions easy.
My preferred setup is:
Enter: insert a new line
Ctrl + Enter: submit the prompt
OpenCode configuration
Edit your OpenCode configuration file and update the keybindings:
{
"keybinds": {
"app_exit": "ctrl+d,<leader>q",
"input_submit": "ctrl+return",
"input_newline": "shift+return,return,alt+return,ctrl+j"
}
}
This tells OpenCode to treat normal Enter-style keys as new lines and reserve Ctrl + Enter for submission.
The terminal may need configuration too
There is one important detail: some terminals do not send a distinct key sequence for Ctrl + Enter by default.
In that case, OpenCode cannot distinguish it from plain Enter.
For Windows Terminal, you can define a custom sequence:
"actions": [
{
"command": {
"action": "sendInput",
"input": "\u001b[13;5u"
},
"id": "User.sendInput.CtrlEnterCustom"
}
]
Then bind Ctrl + Enter to that action in the terminal settings.
The exact terminal configuration can vary, but the principle is the same: the terminal must send a distinguishable sequence before OpenCode can bind it separately.
Why this improves the workflow
Long prompts often contain code blocks, lists, and multiple paragraphs.
Making Enter safe for editing removes the pressure to finish the whole prompt on one line and reduces accidental sends.
It also makes OpenCode behave more like many chat and editor-oriented interfaces.
Closing thoughts
Keybindings are a small detail, but AI coding tools are used interactively for long periods. Small interaction problems become surprisingly expensive when repeated all day.
For me, separating newline and submit made OpenCode much more comfortable to use.
Read original: https://dev.to/loach2009/using-ctrlenter-to-submit-in-opencode-and-enter-for-new-lines-2065
PreviousUsers in Houthi-Held Yemen Tried to Develop Advanced Weapons With AI, Anthropic SaysNextUsing go fix to modernize Go code
Related posts
Adventurer returns home to Hull after 28-year walk from South America
0Hacker News New
Vending machine has terms and conditions you must accept before using [video]
0Hacker News New
Tomorrow Corporation Tech Demo [video]
0Hacker News New
Does Social Status Run in Families?
0Hacker News New
Show HN: Svoxx – A multilingual freelance marketplace with social features
0Hacker News New
433MHz TUI scanner: using a FT232H connected to a CC1101
0Hacker News New