opencode icon indicating copy to clipboard operation
opencode copied to clipboard

How do you insert a new line into the prompt box? (using mac + ghostty)

Open epicwhale opened this issue 1 year ago • 39 comments

For some reason, I can't introduce a line break in my input. Tried Ctrl + enter, Opt + enter, Cmd + enter - no luck. How do I type over multiple lines?

Tried in both ghostty and vs code terminal.

Able to do an Opt + Enter for line break in gemini-cli and claude-code successfully in the same environment.

❯ opencode --version
0.12.0

epicwhale avatar Sep 27 '25 08:09 epicwhale

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

  • #1505: shift+enter keybinding not working - This issue describes similar problems with multiline input where shift+enter doesn't work to insert newlines, though it mentions ctrl+j works as an alternative

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

github-actions[bot] avatar Sep 27 '25 08:09 github-actions[bot]

@epicwhale have u tried shift + enter?

that is what i use and it should be the default

rekram1-node avatar Sep 27 '25 14:09 rekram1-node

@epicwhale have u tried shift + enter?

that is what i use and it should be the default

Yes, sadly, does not work. Shift Enter simply sends the command. You will see this reported in other similar bugs mentioned too.

epicwhale avatar Sep 27 '25 14:09 epicwhale

@epicwhale have u tried shift + enter? that is what i use and it should be the default

Yes, sadly, does not work. Shift Enter simply sends the command. You will see this reported in other similar bugs mentioned too.

@rekram1-node shift enter not working reported by another user too, same boat: https://github.com/sst/opencode/issues/1505#issuecomment-3322134644

epicwhale avatar Sep 27 '25 14:09 epicwhale

@epicwhale hmm works fine on my end, there could be other things in your system interfering?, I heard people using tmux have this often.

Alternatives:

  • try cmd + j
  • use the "keybinds" in your config to remap it

rekram1-node avatar Sep 27 '25 14:09 rekram1-node

@rekram1-node not using tmux. Oddly works in Claude code and Gemini CLI.. so I can't imagine what in the system would be intefering. The + j combination key works, but really find that unusual. Want a combo with enter.. struggling with getting a keybind to fix it too, sadly :(

@epicwhale hmm works fine on my end, there could be other things in your system interfering?, I heard people using tmux have this often.

Alternatives:

  • try cmd + j
  • use the "keybinds" in your config to remap it

epicwhale avatar Sep 27 '25 15:09 epicwhale

hm there may be something weird on our end then, not sure I haven’t been able to replicate this.

once the tui rewrite is done some key captures may perform better so I hope this will be addressed by the rewrite

rekram1-node avatar Sep 27 '25 15:09 rekram1-node

For now I am going to close as duplicate of #1505

what keybind did you try to remap it to?

rekram1-node avatar Sep 27 '25 19:09 rekram1-node

@rekram1-node here's what I tried in ~/.config/opencode/opencode.json

Image

did I get something wrong?

epicwhale avatar Sep 27 '25 22:09 epicwhale

@rekram1-node okay so oddly with the keybind above, ctrl+enter works in Ghostty (but shift+enter does not), and neither of the two keybinds work in VS Code terminal.

epicwhale avatar Sep 27 '25 22:09 epicwhale

weird, so the vscode one doesn’t surprise me because their app will try to capture some of the bindings

once the migration is complete I think we can address these better, rn it is an annoying issue so I apologize

rekram1-node avatar Sep 27 '25 23:09 rekram1-node

weird, so the vscode one doesn’t surprise me because their app will try to capture some of the bindings

once the migration is complete I think we can address these better, rn it is an annoying issue so I apologize

Thanks for the replies and trying to troubleshoot! May I ask out of curiosity when is this TUI migration expected? Looks like a major overhaul!

epicwhale avatar Sep 28 '25 06:09 epicwhale

I am thinking it should be done within a week or two but I can’t say for sure, you can track progress here: https://github.com/sst/opencode/pull/2685

rekram1-node avatar Sep 28 '25 13:09 rekram1-node

@epicwhale Try \ then Enter

fkukuck avatar Sep 29 '25 06:09 fkukuck

@epicwhale Try \ then Enter

this works!!

epicwhale avatar Sep 29 '25 07:09 epicwhale

\ then enter is even submitting the prompt on MacOS using Warp Terminal

philharmonie avatar Jan 15 '26 13:01 philharmonie

\ then enter is even submitting the prompt on MacOS using Warp Terminal

Exactly this

Flagrare avatar Jan 15 '26 14:01 Flagrare

🙏 Yes, how do we do a new line?

srs-adamr avatar Jan 15 '26 16:01 srs-adamr

🙏 Yes, how do we do a new line?

Ctrl + J seems to do the trick for me on Warp terminal

vinayakkulkarni avatar Jan 16 '26 08:01 vinayakkulkarni

Mac + Kitty you can use option + enter

rpajunen avatar Jan 16 '26 13:01 rpajunen