Shift-return does not input newline since 1.0 #2671

Open
opened 2026-02-16 17:36:45 -05:00 by yindo · 28 comments
Owner

Originally created by @markjaquith on GitHub (Nov 7, 2025).

Originally assigned to: @kommander on GitHub.

Description

I cannot enter newlines with shift-return since Opencode 1.0

Worked fine before, without any custom mapping in Ghostty to ctrl-j or whatever. Also does not work in macOS Terminal app.

I have no custom Ghostty or Opencode keybinds that could be interfering.

OpenCode version

1.0.40

Steps to reproduce

  1. opencode
  2. type something{shift-return} (nothing happens)

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Ghostty (with or without Tmux)

Originally created by @markjaquith on GitHub (Nov 7, 2025). Originally assigned to: @kommander on GitHub. ### Description I cannot enter newlines with shift-return since Opencode 1.0 Worked fine before, without any custom mapping in Ghostty to `ctrl-j` or whatever. Also does not work in macOS Terminal app. I have no custom Ghostty or Opencode keybinds that could be interfering. ### OpenCode version 1.0.40 ### Steps to reproduce 1. `opencode` 2. `type something{shift-return}` (nothing happens) ### Screenshot and/or share link _No response_ ### Operating System macOS ### Terminal Ghostty (with or without Tmux)
yindo added the opentuibug labels 2026-02-16 17:36:45 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 7, 2025):

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

  • #1505: shift+enter keybinding not working - This appears to be the same exact issue with shift+enter not inserting newlines while ctrl+j works as an alternative. Issue #1505 includes detailed technical analysis of the root cause.

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

@github-actions[bot] commented on GitHub (Nov 7, 2025): This issue might be a duplicate of existing issues. Please check: - #1505: shift+enter keybinding not working - This appears to be the same exact issue with shift+enter not inserting newlines while ctrl+j works as an alternative. Issue #1505 includes detailed technical analysis of the root cause. Feel free to ignore if none of these address your specific case.
Author
Owner

@markjaquith commented on GitHub (Nov 7, 2025):

Workaround for now in Ghostty config:

keybind = shift+enter=text:\x1b[13;2u
@markjaquith commented on GitHub (Nov 7, 2025): Workaround for now in Ghostty `config`: ``` keybind = shift+enter=text:\x1b[13;2u ```
Author
Owner

@anaetrezve commented on GitHub (Nov 7, 2025):

In case you are facing an issue with Ghostty and Tmux, here is my workaround

@anaetrezve commented on GitHub (Nov 7, 2025): In case you are facing an issue with Ghostty and Tmux, [here](https://github.com/sst/opencode/issues/1505#issuecomment-3505571403) is my workaround
Author
Owner

@kommander commented on GitHub (Nov 8, 2025):

Should be fixed in the latest version

@kommander commented on GitHub (Nov 8, 2025): Should be fixed in the latest version
Author
Owner

@mattnico commented on GitHub (Nov 10, 2025):

I have tried every version of this, ctrl+enter, cmd+enter, shift+enter, \ then enter. None of them work for me in v1.0.55

ctrl + j works but that is incredibly awkward.

I'm on mac OS using the default terminal.

@mattnico commented on GitHub (Nov 10, 2025): I have tried every version of this, ctrl+enter, cmd+enter, shift+enter, \ then enter. None of them work for me in v1.0.55 ctrl + j works but that is incredibly awkward. I'm on mac OS using the default terminal.
Author
Owner

@kommander commented on GitHub (Nov 10, 2025):

Default MacOS terminal does not send any modifiers for return/backspace, there is no way to capture that shift is pressed along with return. You need to use a modern terminal like Ghostty, Kitty or Alacritty.

@kommander commented on GitHub (Nov 10, 2025): Default MacOS terminal does not send any modifiers for return/backspace, there is no way to capture that shift is pressed along with return. You need to use a modern terminal like Ghostty, Kitty or Alacritty.
Author
Owner

@mattnico commented on GitHub (Nov 10, 2025):

I figured that might be the response, but that doesn't explain why \ +enter wouldn't work or why cmd+enter (used to) work in Claude Code. I guess I'll upgrade to a big boy terminal.

@mattnico commented on GitHub (Nov 10, 2025): I figured that might be the response, but that doesn't explain why \ +enter wouldn't work or why cmd+enter (used to) work in Claude Code. I guess I'll upgrade to a big boy terminal.
Author
Owner

@kommander commented on GitHub (Nov 10, 2025):

There are probably some more tricks we can implement, or use native OS key events as a workaround. None of that works currently though I am afraid. I'll look some more into it.

@kommander commented on GitHub (Nov 10, 2025): There are probably some more tricks we can implement, or use native OS key events as a workaround. None of that works currently though I am afraid. I'll look some more into it.
Author
Owner

@thdxr commented on GitHub (Nov 11, 2025):

how does this look on 1.0.59?

@thdxr commented on GitHub (Nov 11, 2025): how does this look on [1.0.59](https://github.com/sst/opencode/commit/0bd11e970b723b8cd59c14dd55e00829d9dcb862)?
Author
Owner

@mattnico commented on GitHub (Nov 12, 2025):

No change on 1.0.61

@mattnico commented on GitHub (Nov 12, 2025): No change on 1.0.61
Author
Owner

@arsham commented on GitHub (Nov 12, 2025):

I hope you don't mind I share some information.
This works only with the alt+enter:

"input_newline": "shift+enter,alt+enter"

I also noticed that the default cycling model only works with f2 and the reverse wouldn't with shift+f2. So far I can see cycling agents with tab and shift+tab is consistent with the default bindings. There might be something going on with handling the shift key.

Edit: my current version is v1.0.61

@arsham commented on GitHub (Nov 12, 2025): I hope you don't mind I share some information. This works only with the `alt+enter`: ```json "input_newline": "shift+enter,alt+enter" ``` I also noticed that the default cycling model only works with `f2` and the reverse wouldn't with `shift+f2`. So far I can see cycling agents with `tab` and `shift+tab` is consistent with the default bindings. There might be something going on with handling the `shift` key. Edit: my current version is `v1.0.61`
Author
Owner

@kommander commented on GitHub (Nov 12, 2025):

I don't understand how any of that ever worked in the macos default terminal. Did all of that work in the pre-opentui opencode in such a terminal?

@kommander commented on GitHub (Nov 12, 2025): I don't understand how any of that ever worked in the macos default terminal. Did all of that work in the pre-opentui opencode in such a terminal?
Author
Owner

@scottrbaxter commented on GitHub (Nov 13, 2025):

Default MacOS terminal does not send any modifiers for return/backspace, there is no way to capture that shift is pressed along with return. You need to use a modern terminal like Ghostty, Kitty or Alacritty.

@kommander

shift+enter works fine in v0.15.31 and any pre v1.0.0 opencode releases that i had tested (iTerm2 3.6.5, macOS Sequoia). this only stopped working with v1.0.0.. even in v1.0.62 (latest) this is still an issue. i can easily roll back to any pre v1.0.0 release and use my config for that release, and this "input_newline": "shift+enter,ctrl+j", keybind works as expected. this is absolutely an opencode v1.0.0+ (opentui?) issue.

what else can i provide to help you with creating a macOS compatible solution? i'm more than happy to help however possible.

edit: ok is it really this simple? it seems that shift+return works fine... it's just that shift+enter no longer works on macOS?
just tested and "input_newline": "shift+return,ctrl+j", works fine in opencode v1.0.62 on macOS Sequoia with iterm2 3.6.5. also tested exactly this in a debian container, works fine.. guess i just cannot use shift+enter, but shift+return seems compatible anywhere i need it.

i guess that's good enough for my needs.

@scottrbaxter commented on GitHub (Nov 13, 2025): > Default MacOS terminal does not send any modifiers for return/backspace, there is no way to capture that shift is pressed along with return. You need to use a modern terminal like Ghostty, Kitty or Alacritty. @kommander `shift+enter` works fine in `v0.15.31` and any pre `v1.0.0` opencode releases that i had tested (iTerm2 `3.6.5`, macOS Sequoia). this only stopped working with `v1.0.0`.. even in `v1.0.62` (latest) this is still an issue. i can easily roll back to any pre `v1.0.0` release and use my config for that release, and this `"input_newline": "shift+enter,ctrl+j",` keybind works as expected. this is absolutely an opencode `v1.0.0`+ (opentui?) issue. what else can i provide to help you with creating a macOS compatible solution? i'm more than happy to help however possible. edit: ok is it really this simple? it seems that `shift+return` works fine... it's just that `shift+enter` no longer works on macOS? just tested and `"input_newline": "shift+return,ctrl+j",` works fine in opencode `v1.0.62` on macOS Sequoia with iterm2 `3.6.5`. also tested exactly this in a debian container, works fine.. guess i just cannot use `shift+enter`, but `shift+return` seems compatible anywhere i need it. i guess that's good enough for my needs.
Author
Owner

@kommander commented on GitHub (Nov 13, 2025):

shift+return works in the latest version on iTerm2, it's just `return` not `enter`. None of that works or has ever worked though in the macos default terminal.

@kommander commented on GitHub (Nov 13, 2025): `shift+return` works in the latest version on iTerm2, it's just \`return\` not \`enter\`. None of that works or has ever worked though in the macos default terminal.
Author
Owner

@kommander commented on GitHub (Nov 13, 2025):

I'll alias return/enter to avoid that confusion

@kommander commented on GitHub (Nov 13, 2025): I'll alias return/enter to avoid that confusion
Author
Owner

@scottrbaxter commented on GitHub (Nov 13, 2025):

yep, i just realized that... since shift+return is compatible across systems, seems like a good idea to update the docs and either make a note for mac/linux users or simply replace shift+enter as the example.

https://opencode.ai/docs/keybinds/

@scottrbaxter commented on GitHub (Nov 13, 2025): yep, i just realized that... since `shift+return` is compatible across systems, seems like a good idea to update the docs and either make a note for mac/linux users or simply replace `shift+enter` as the example. https://opencode.ai/docs/keybinds/
Author
Owner

@kommander commented on GitHub (Nov 13, 2025):

The confusion is from input handling I guess. Line feed \n is usually enter, while \r is return, these are two different inputs. A keybinding like shift+linefeed would actually work, but effectively both would do the same. I'll go with the alias.

@kommander commented on GitHub (Nov 13, 2025): The confusion is from input handling I guess. Line feed `\n` is usually `enter`, while `\r` is return, these are two different inputs. A keybinding like `shift+linefeed` would actually work, but effectively both would do the same. I'll go with the alias.
Author
Owner

@scottrbaxter commented on GitHub (Nov 13, 2025):

that's great insight, thanks for clarifying and providing a solution! I'm loving this tool more and more every day.

@scottrbaxter commented on GitHub (Nov 13, 2025): that's great insight, thanks for clarifying and providing a solution! I'm loving this tool more and more every day.
Author
Owner

@taqtiqa-mark commented on GitHub (Nov 25, 2025):

Default MacOS terminal does not send any modifiers for return/backspace, there is no way to capture that shift is pressed along with return. You need to use a modern terminal like Ghostty, Kitty or Alacritty.

I'm using (linux) alacritty+zellij, and see the same behavior, c-j works but not anything else. keybindings:

    "leader": "ctrl-x"
    "input_clear": "<leader>del",
    "input_paste": "ctrl+v",
    "input_submit": "<leader>enter",
    "input_newline": "shift+enter",

With those bindings, leader setting works for other actions, browsing subagents/tasks:

  • shift-enter: NA
  • enter: input_submit
  • ctrl-x enter: NA
  • ctrl-j: input_newline

Alacritty setting:

bindings = [
    # { key = "Key", mods = "Modifiers", action = "Action" },
    # { key = "Key", mods = "Modifiers", chars = "Characters to send" },
    # ...
    { key = "F",      mods = "Control|Shift", chars = "\u001b[70;5;2u"}
]

Zellij setting:

keybinds clear-defaults=true {
      unbind "Ctrl Shift f"
      unbind "Shift Enter"
      unbind "Shift Return"
....
}
@taqtiqa-mark commented on GitHub (Nov 25, 2025): > Default MacOS terminal does not send any modifiers for return/backspace, there is no way to capture that shift is pressed along with return. You need to use a modern terminal like Ghostty, Kitty or Alacritty. I'm using (linux) alacritty+zellij, and see the same behavior, c-j works but not anything else. keybindings: ```jsonc "leader": "ctrl-x" "input_clear": "<leader>del", "input_paste": "ctrl+v", "input_submit": "<leader>enter", "input_newline": "shift+enter", ``` With those bindings, leader setting works for other actions, browsing subagents/tasks: - shift-enter: NA - enter: input_submit - ctrl-x enter: NA - ctrl-j: input_newline Alacritty setting: ```toml bindings = [ # { key = "Key", mods = "Modifiers", action = "Action" }, # { key = "Key", mods = "Modifiers", chars = "Characters to send" }, # ... { key = "F", mods = "Control|Shift", chars = "\u001b[70;5;2u"} ] ``` Zellij setting: ```kdl keybinds clear-defaults=true { unbind "Ctrl Shift f" unbind "Shift Enter" unbind "Shift Return" .... } ```
Author
Owner

@taqtiqa-mark commented on GitHub (Nov 25, 2025):

The confusion is from input handling I guess. Line feed \n is usually enter, while \r is return, these are two different inputs. A keybinding like shift+linefeed would actually work, but effectively both would do the same. I'll go with the alias.

v1.0.109

The following result it the text being submitted (linux, alacritty, zellij):

"input_newline": "shift+return"

and

"input_newline": "shift+linefeed"
@taqtiqa-mark commented on GitHub (Nov 25, 2025): > The confusion is from input handling I guess. Line feed `\n` is usually `enter`, while `\r` is return, these are two different inputs. A keybinding like `shift+linefeed` would actually work, but effectively both would do the same. I'll go with the alias. **v1.0.109** The following result it the text being submitted (linux, alacritty, zellij): ```jsonc "input_newline": "shift+return" ``` and ```jsonc "input_newline": "shift+linefeed" ```
Author
Owner

@taqtiqa-mark commented on GitHub (Nov 25, 2025):

The Alacritty workaround suggested here (https://github.com/sst/opencode/issues/1505#issuecomment-3558522163), allowed me to input a newline with this keybinding:

    # borked: return, enter, linefeed
    "input_submit": "<leader>return",
    # Alacritty workaround: { key = "Return", mods = "Shift", chars = "\n" }
    "input_newline": "shift+return",

@kommander do you consider the Alacritty change a fix or a workaround?

@taqtiqa-mark commented on GitHub (Nov 25, 2025): The Alacritty workaround suggested here (https://github.com/sst/opencode/issues/1505#issuecomment-3558522163), allowed me to input a newline with this keybinding: ```jsonc # borked: return, enter, linefeed "input_submit": "<leader>return", # Alacritty workaround: { key = "Return", mods = "Shift", chars = "\n" } "input_newline": "shift+return", ``` @kommander do you consider the Alacritty change a fix or a workaround?
Author
Owner

@kommander commented on GitHub (Nov 25, 2025):

If the default is still enter it's not fixed, no

@kommander commented on GitHub (Nov 25, 2025): If the default is still `enter` it's not fixed, no
Author
Owner

@vlabo commented on GitHub (Jan 3, 2026):

I have the same issue with windows terminal.
But alacritty on windows works.

@vlabo commented on GitHub (Jan 3, 2026): I have the same issue with windows terminal. But alacritty on windows works.
Author
Owner

@rekram1-node commented on GitHub (Jan 3, 2026):

@vlabo see docs: https://opencode.ai/docs/keybinds/#shiftenter

@rekram1-node commented on GitHub (Jan 3, 2026): @vlabo see docs: https://opencode.ai/docs/keybinds/#shiftenter
Author
Owner

@alekscp commented on GitHub (Jan 7, 2026):

Here's what worked for me on ghostty:

keybind = shift+enter=text:\x1b\r
@alekscp commented on GitHub (Jan 7, 2026): Here's what worked for me on `ghostty`: ``` keybind = shift+enter=text:\x1b\r ```
Author
Owner

@voltrevo commented on GitHub (Jan 15, 2026):

I run into this issue frequently.

Opencode: 1.1.23
vscode integrated terminal (vscode remote ssh, host=macOS tahoe, guest=ubuntu server)

(I appreciate that workarounds may be possible but this should be fixed in opencode itself yeah?)

@voltrevo commented on GitHub (Jan 15, 2026): I run into this issue frequently. Opencode: 1.1.23 vscode integrated terminal (vscode remote ssh, host=macOS tahoe, guest=ubuntu server) (I appreciate that workarounds may be possible but this should be fixed in opencode itself yeah?)
Author
Owner

@voltrevo commented on GitHub (Jan 15, 2026):

Update: According to my research shift+enter actually cannot usually be detected in the terminal, so for most people the answer would be 'it can't be done in your terminal'.

Possibly though, with the rise of ai coding tui's like opencode, popular terminals like vscode's integrated terminal should add a little fairy dust to make this work.

@voltrevo commented on GitHub (Jan 15, 2026): Update: According to my research shift+enter actually cannot usually be detected in the terminal, so for most people the answer would be 'it can't be done in your terminal'. Possibly though, with the rise of ai coding tui's like opencode, popular terminals like vscode's integrated terminal should add a little fairy dust to make this work.
Author
Owner

@crd2333 commented on GitHub (Feb 3, 2026):

For anyone trying to find a solution in VSCode integrated terminal, I write this to my keybinding.json of VSCode (no modify opencode):

    {  // deal with VSCode integrated terminal sending Ctrl/Shift+Enter as Enter issue
        "key": "shift+enter",
        "command": "workbench.action.terminal.sendSequence",
        "args": { "text": "\u001b\n" }, // rebind shift+enter to alt+enter behavior
        "when": "terminalFocus"
    },
    {
        "key": "ctrl+enter",
        "command": "workbench.action.terminal.sendSequence",
        "args": { "text": "\u001b\n" }, // rebind ctrl+enter to alt+enter behavior
        "when": "terminalFocus"
    }

And be sure your terminal.integrated.sendKeybindingsToShell in VSCode settings.json is false (default value).

Env:
opencode 1.1.49
Vscode integrated terminal (by vscode remote ssh, ubuntu linux as server, windows as local machine).

Now your terminal (including opencode) will be as expected —— ctrl/shift+enter as newline, and single enter as send.

@crd2333 commented on GitHub (Feb 3, 2026): For anyone trying to find a solution in VSCode integrated terminal, I write this to my keybinding.json of VSCode (no modify opencode): ```jsonc { // deal with VSCode integrated terminal sending Ctrl/Shift+Enter as Enter issue "key": "shift+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u001b\n" }, // rebind shift+enter to alt+enter behavior "when": "terminalFocus" }, { "key": "ctrl+enter", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u001b\n" }, // rebind ctrl+enter to alt+enter behavior "when": "terminalFocus" } ``` And be sure your `terminal.integrated.sendKeybindingsToShell` in VSCode settings.json is false (default value). Env: opencode 1.1.49 Vscode integrated terminal (by vscode remote ssh, ubuntu linux as server, windows as local machine). Now your terminal (including opencode) will be as expected —— ctrl/shift+enter as newline, and single enter as send.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2671