Repository navigation
Description
Problem Summary
I'm trying to configure OpenCode to use the following AI chat keybindings:
- Enter = Submit message
- Shift+Enter = Insert new line
However, despite configuring , Shift+Enter still submits the message instead of inserting a new line. This behavior is consistent across multiple terminal environments.
Environment
- OpenCode Version: 1.1.49
- OS: Windows 11 Pro
- Terminals Tested:
- Google Antigravity
- Warp Terminal
- Windows Terminal (PowerShell)
Configuration Applied
File Location: %APPDATA%\opencode\opencode.json (e.g., C:\Users\[USER]\AppData\Roaming\opencode\opencode.json)
Configuration Content:
{
"keybinds": {
"input_newline": "shift+enter",
"input_submit": "enter"
}
}What We've Tried
- ✅ Located config file - Found at
%APPDATA%\opencode\opencode.json - ✅ Created backup -
opencode.json.backup - ✅ Applied configuration - Added both
input_newlineandinput_submitexplicitly - ✅ Restarted OpenCode - Full restart between tests
- ✅ Tested multiple terminals - Same behavior across all terminals
- ✅ Validated JSON - Configuration is valid JSON
Test Results
| Terminal | Enter | Shift+Enter | Ctrl+Enter | Alt+Enter |
|---|---|---|---|---|
| Google Antigravity | Submits | Submits ❌ | Submits ❌ | New line |
| Warp Terminal | Submits | Submits ❌ | New line ✓ | Creates 'nter' text |
| Windows Terminal (PowerShell) | Submits | Submits ❌ | New line ✓ | Maximize window |
Expected: Shift+Enter should insert a new line
Actual: Shift+Enter submits the message (same as Enter)
Notes:
- Ctrl+Enter behavior varies by terminal (submits in Antigravity, new line in Warp and Windows Terminal)
- Alt+Enter in Google Antigravity creates the text 'nter' in the message box instead of inserting a newline
Documentation References
Based on the OpenCode documentation and GitHub repository research, the configuration object should support:
-
- Key to insert a new line in the input
-
- Key to submit the message
We've tried the following key name formats:
- (current)
- (alternative, not yet tested)
- (Emacs-style, not yet tested)
Questions
-
Are these the correct keybind names? The documentation mentions configuration but doesn't specify the exact key names for and .
-
Is there a different key name format we should use? For example:
- instead of ?
- (capitalized)?
- (Emacs-style)?
-
Is this a known issue with version 1.1.49? The configuration appears to be ignored entirely.
-
Where can we find the complete list of supported keybind actions and key names? The current documentation doesn't seem to cover this in detail.
Steps to Reproduce
- Open (create if doesn't exist)
- Add the keybinds configuration shown above
- Save and close OpenCode completely
- Reopen OpenCode in any terminal
- Type text in the chat input
- Press Shift+Enter
- Observe: Message submits instead of inserting new line
Additional Context
- We've confirmed the configuration file is being read (JSON syntax errors cause OpenCode to fail to start)
- The issue persists across terminal environments, suggesting it's not terminal-specific
- We're willing to test alternative key name formats or provide logs if helpful
**Please let us know if there's additional information we can provide or debugging steps we should try. Thank you!
Activity
github-actions commentedon Feb 3, 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.
DaveW001 commentedon Feb 3, 2026
Note: I reviewed potential duplicates. They overlap, but are not the same. In my case, I am trying to use the opencode jscon to remap keybindings. The open threads/issues appear to not be related to keybinding mappings.
rekram1-node commentedon Feb 3, 2026
Some terminals don't support it out of the box because they don't send anything we can key off of. You will need to modify your terminal settings to send correct modifiers so that opencode has some way to distinguish between enter and shift enter.
We have examples in our keybinding docs for windows terminal.
phazei commentedon Mar 15, 2026
I'm having this issue in PowerShell v7 as well.
Ctrl+Enter => only way to get a new line.
But Ctrl+Enter is often explicitly to submit, so it's extra confusing because of all the shortcuts, that one I'd actually want to submit.
bavarianbidi commentedon May 6, 2026
@DaveW001
If you are on linux, you can try tostraceopencode (viastrace -o /tmp/opencode.txt opencode).At least on my machine i didn't saw any attemps from opencode to try to read a file called
tui.json(just grep on the strace output file).wanted to achieve the same as "newline" only works withalt+enterwhich i never use in any other tool - so wanted to keepopencodealigned with all my other tooling.xref: #26040
Doing it right (following child processes) confirms, that the
tui.jsonfile in the documented locations is taken into account:But the initial problem still persist - my custom key-bindings especially for
input_newlinedon't workmtremr commentedon May 18, 2026
Folks, let me share my Shift+ENTER key remapping in Windows Terminal for Windows11, WSL2 stack (I actually use Ctrl+ENTER combo for submitting, it's waaaaay trickier to achieve, though didn't test recent bug fixes with
keymap):Shift+Enter/Enterinopencode.json/tui.jsonconfigs)Settings->Open JSON fileoption in bottom-left corner OR hit shortcutCtrl+Shift+,(it openssettings.jsonin a path like C:\Users\<user>\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json).SCENARIO#1 (one insertion, Windows Terminal engine will then split/regenerate code, details below):
{ "command": { "action": "sendInput", "input": "\n" }, "keys": "shift+enter" }SCENARIO#2 (we place two objects manually in different arrays, Windows Terminal engine doesn't regenerate a thing):
{ "command": { "action": "sendInput", "input": "\n" }, "id": "User.sendInput.DFCDAF06" }keys="shift+enter", just change it'sid="User.sendInput.DFCDAF06"):{ "id": "User.sendInput.DFCDAF06", "keys": "shift+enter" }Caution
While injecting an object into
Windows Terminal's settings.json please don't forget to input trailing comma if placing in between.If all done correctly Windows Terminal handles remapping on the fly -- it works instantly in existing terminal (no reloads needed).
Note
Hint to easily remap any combo in Windows Terminal:
settings.json.github-actions commentedon Jul 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
tlee75 commentedon Aug 24, 2026
Building off what was already posted here, I got SHIFT+ENTER to work by doing this:
Open Windows Terminal. Press Ctrl+Shift+, (comma) to open your raw settings.json file.
Add this code block inside your top-level "actions"
Add this code block inside your top-level "keybindings"