claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Support shift+enter in most terminals

Open net opened this issue 6 months ago • 3 comments

You can capture shift+enter using the kitty protocol, which is supported by kitty, ghostty, alacritty, wezterm, iterm2, and some more terminals I haven't heard of.

This will also be better for iterm2 users, as it won't break their shift+enter for other TUIs.

net avatar Jun 07 '25 15:06 net

Agreed on this. Copying my info from a duplicate issue that I just closed:

[The remapping] ...requires the whole terminal-setup command, causes behavior that changes depending on which terminal you are running within, and the feature can be broken based on the user's modification of their own config files for other programs.

In other sophisticated TUI applications, distinguishing these inputs can be done with control sequence identifiers. This would greatly ease user onboarding, as many modern terminals are setup to use one of these two codes. (As an example, in a new terminal window run cat with no input and then press shift+enter to show the exact sequence identifier received over stdin)

The two codes that could support this ought to be:

  1. CSI u code for shift+enter: ^[[13;2u
  2. modifyOtherKeys code for shift+enter: ^[[27;2;13~

CSI u is from the extended keys format, is more widely supported and more modern, and would be a great starting point!

For what it's worth, Codex already supports CSI u for shift+enter and other keybindings. More details in the summary here: https://github.com/sst/opencode/issues/1505#issuecomment-3411334883

CSRessel avatar Oct 17 '25 00:10 CSRessel

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 07 '25 10:12 github-actions[bot]