Skip to content

Keyboard keybinds configuration not working - input_newline: shift+enter ignored #11983

Closed as not planned

Description

@DaveW001

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

  1. ✅ Located config file - Found at %APPDATA%\opencode\opencode.json
  2. ✅ Created backup - opencode.json.backup
  3. ✅ Applied configuration - Added both input_newline and input_submit explicitly
  4. ✅ Restarted OpenCode - Full restart between tests
  5. ✅ Tested multiple terminals - Same behavior across all terminals
  6. ✅ 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

  1. Are these the correct keybind names? The documentation mentions configuration but doesn't specify the exact key names for and .

  2. Is there a different key name format we should use? For example:

    • instead of ?
    • (capitalized)?
    • (Emacs-style)?
  3. Is this a known issue with version 1.1.49? The configuration appears to be ignored entirely.

  4. 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

  1. Open (create if doesn't exist)
  2. Add the keybinds configuration shown above
  3. Save and close OpenCode completely
  4. Reopen OpenCode in any terminal
  5. Type text in the chat input
  6. Press Shift+Enter
  7. 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

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Feb 3, 2026
  2. github-actions commented on Feb 3, 2026

    @github-actions
    Contributor

    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.

  3. DaveW001 commented on Feb 3, 2026

    @DaveW001
    Author

    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.

  4. rekram1-node commented on Feb 3, 2026

    @rekram1-node
    Collaborator

    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.

  5. phazei commented on Mar 15, 2026

    @phazei

    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.

  6. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  7. bavarianbidi commented on May 6, 2026

    @bavarianbidi

    @DaveW001
    If you are on linux, you can try to strace opencode (via strace -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 with alt+enter which i never use in any other tool - so wanted to keep opencode aligned with all my other tooling.

    xref: #26040

    Doing it right (following child processes) confirms, that the tui.json file in the documented locations is taken into account:

    strace -f -s 4096 -o /tmp/opencode-strace.txt -e trace=%file -- opencode

    But the initial problem still persist - my custom key-bindings especially for input_newline don't work

  8. mtremr commented on May 18, 2026

    @mtremr

    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):

    1. Works with default keybinds (don't need to remap Shift+Enter/Enter in opencode.json/tui.json configs)
    2. Open WSL2
    3. Open Settings -> Open JSON file option in bottom-left corner OR hit shortcut Ctrl+Shift+, (it opens settings.json in 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):

    1. find "actions" array, put this keybind into it:
    {
      "command": { "action": "sendInput", "input": "\n" },
      "keys": "shift+enter"
    }
    1. Save file. Editor might ask you to reload the file -- it is OK due to Windows Terminal engine will automatically split this object into two parts and keep one in "actions" array and place another part into "keybindings" array (see SCENARIO#2 for details).

    SCENARIO#2 (we place two objects manually in different arrays, Windows Terminal engine doesn't regenerate a thing):

    1. find "actions" array, put this action mapping:
    {
        "command": 
        {
            "action": "sendInput",
            "input": "\n"
        },
        "id": "User.sendInput.DFCDAF06"
    }
    1. find "keybindings" array, put this object into it (if already have object with keys="shift+enter", just change it's id="User.sendInput.DFCDAF06"):
    {
        "id": "User.sendInput.DFCDAF06",
        "keys": "shift+enter"
    }
    1. Save file. You won't see any file regeneration.

    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:

    • give a prompt like that to Google, check out AI response:
    windows terminal remap ctrl+alt+u to ctrl+y
    
    • it'll return JSON object that should be injected into mentioned settings.json.
  9. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  10. tlee75 commented on Aug 24, 2026

    @tlee75

    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"

    {
      "command": { "action": "sendInput", "input": "\u001b[13;2u" },
      "id": "User.sendInput.ShiftEnterCustom"
    }
    

    Add this code block inside your top-level "keybindings"

    {
      "keys": "shift+enter",
      "id": "User.sendInput.ShiftEnterCustom"
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions