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

Feature Request: configuration option that makes ENTER insert newline instead of submitting prompt

Open ntc2 opened this issue 7 months ago • 7 comments

Context

There are currently roughly 7 open and 18 closed issues related to users having trouble with the default "submit prompt on ENTER" behavior: https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20submit%20enter (not all, but nearly all of these issues are related to ENTER behavior).

There is a popular issue (currently 25 comments) where someone requested changing the default behavior so that ENTER doesn't submit prompt, and that was closed as wontfix. And here is another issue where someone asked about how to make ENTER insert a newline. And here is a more general issue concerned with multiline prompts. I understand it's not possible to change the default.

Feature Request

Here I'm asking for the option to configure a non-default behavior, where ENTER inserts a newline without submitting the prompt, and some other sequence (e.g. CTRL+ENTER) is needed to submit the prompt. Here is another issue requesting the same thing. (I would also like this option in the web UI for Claude, but I realize that's out of scope here.)

For example, Slack has a configuration option and Mattermost has a configuration option to make ENTER insert newline and CTRL+ENTER send messages. In Claude Code, this could be available via a slash command, e.g.

/multiline-mode on

and when this is set, the ? help could show that CTRL+ENTER sequence is needed to submit the prompt. I would want this config setting to persist between Claude runs, e.g. by being stored in the ~/.claude/settings.json.

Currently Supported Ways to Enter Multiline Prompts

These are workarounds, but don't solve my problem.

Summary of currently supported ways to enter multiline prompts:

  • ALT+ENTER: works for me
  • SHIFT+ENTER: many people report this doesn't work for them and there is a tracking issue here; it doesn't work for me
    • running /terminal-setup first may help, but it doesn't help for me
  • insert backslash (\) at end of line before ENTER: works for me

However, note that none of these are very ergonomic, since they all require extra work for every newline in the prompt.

ntc2 avatar Jun 19 '25 21:06 ntc2

shift-enter++ That'd be my choice.

DwayneSmurdon avatar Jun 20 '25 07:06 DwayneSmurdon

shift-enter is what I expected and keep hitting based on muscle memory

simen avatar Jun 20 '25 12:06 simen

I can confirm that the key binding added by /terminal-setup in keybindings.json for Shift + Enter on VS Code doesn't work for me either. Alt + Enter and \ both work.

Support for Shift + Enter would be ideal

cpcdoy avatar Jun 23 '25 10:06 cpcdoy

To clarify, there are a few comments mentioning SHIFT+ENTER to insert newline without submitting prompt: that is a different issue, e.g. tracked here. This issue: I want an option to make plain ENTER insert a newline without submitting the prompt. The sequence to submit the prompt could then be CTRL+ENTER.

ntc2 avatar Jun 23 '25 21:06 ntc2

I really want this option! It’s super inconvenient for speakers of languages like Japanese, where we use Enter a lot when writing, to have it submit with Enter.

convcha avatar Jun 25 '25 03:06 convcha

I am also in this camp. Please let us turn off Enter as automatic-submit. I'd much prefer a key combination in order to submit commands, considering that it wastes tokens if you do it prematurely. Shift+Enter would be fine, but that didn't work for me, either.

woldaker avatar Jun 29 '25 04:06 woldaker

CopilotChat.nvim uses CTRL-s to submit the prompt (mnemonic is "submit").

cjrh avatar Jun 29 '25 11:06 cjrh

Shift+Enter camp here.

Rationale: muscle memory from ChatGPT, Claude AI, WhatsApp web, Signal desktop, Discord, Slack, Telegram web, Telegram desktop, Skype, Twitter DMs and almost every single "chat" app in the whole wide world...

maraoz avatar Jul 22 '25 00:07 maraoz

I noticed recently using Claude Code within a Jetbrains term, Shift-Enter now does work for newlines (and Enter for submit).

cjrh avatar Jul 22 '25 09:07 cjrh

i would genuinely upgrade to max20x for a month if i could use shift-enter to do multiline prompts within the cli. an opt-in option is totally fine.

(i run the cc cli in alacritty on linux with zed as my ide, so using iterm2 or vscode/jetbrains is not an option for me)

evansgp avatar Aug 01 '25 10:08 evansgp

Is a pain not being able to configure this.. Shift-Enter isn't working from me either from out of the box (I'm not in VSCode).

vizcay avatar Aug 11 '25 14:08 vizcay

Thank you for this feature request! While Claude Code doesn't currently have a built-in configuration option to change the default ENTER key behavior, you can achieve similar functionality by following the steps in https://docs.anthropic.com/en/docs/claude-code/terminal-config#line-breaks

bogini avatar Aug 22 '25 19:08 bogini

@bogini looking at that page, I don't see where it describes achieving similar functionality. There is the "Keyboard shortcut: Set up a keybinding to insert a newline", but I'm not sure what that means? Is it suggesting that I can setup a shortcut using some other app that inserts \n, but is not ENTER, and that Claude will treat that differently from ENTER?

ntc2 avatar Aug 23 '25 07:08 ntc2

@bogini To get SHIFT-ENTER to insert newlines using Claude Code within Kitty Term, one can add this to their ~/.config/kitty/kitty.conf:

map --when-focus-on title:claude shift+enter send_text normal,application \n

What is the process to get this added to the doc page you linked?

cjrh avatar Aug 23 '25 13:08 cjrh

The ability to configure Claude Code to make enter create newline instead of submitting would be extremely useful. Having spent considerable time on a variety of similar tools, I've found value in writing detailed prompts to achieve good outcomes one-shot results. I note that Amp Code has default behavior to Enter=newline for just this reason.

I disagree with arguments about making behavior consistent with chat apps like Slack, etc. - Claude Code isn't a chat app, even if it can look like one at first glance. If you mistype something in Slack you can amend your message after, or clarify in a subsequent message. In CC, a premature submission wastes time and tokens.

beldaz avatar Aug 25 '25 00:08 beldaz

@bogini Completely agree with @beldaz. The default Enter behavior is inappropriate for the use case, where one is often typing and editing long prompts.

I also note that, in the terminal on Ubuntu at least, the default behavior is not even consistent with Slack. It's completely unique behavior that requires learning new muscle memory. It much worsens the Claude Code user experience and frequently results in premature submissions.

What exactly is the intention behind the very strange & inconvenient default behavior?

jmcvetta avatar Aug 25 '25 06:08 jmcvetta

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Sep 01 '25 14:09 github-actions[bot]