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

Incorrect Enter Key Behavior in VIM Insert Mode for Prompt Submission

Open frantisekstanko opened this issue 9 months ago • 5 comments

Bug Description Pressing enter (carriage return) while in VIM INSERT mode submits the prompt. I would expect enter to insert a newline while in VIM INSERT mode. I would expect to exit the INSERT mode to be able to submit the prompt.

Environment Info

  • Platform: linux
  • Terminal: tmux
  • Version: 1.0.34
  • Feedback ID: 260215f0-4f45-4a6c-a656-d5236ed8a390

Errors

[]

frantisekstanko avatar Jun 25 '25 17:06 frantisekstanko

I don't think it's fair to mark this duplicate. The other similar issues I see are asking for change to default behavior or a config flag.

By contrast, here, we want <Enter> during "INSERT MODE" to insert a carriage return, which is actually the most sane thing to do.

The modal character of vim editing is perfectly suited to disambiguating between keystrokes sent as content and keystrokes sent as commands, but the semantics need to be taken seriously for it to work well.

bukzor avatar Aug 02 '25 23:08 bukzor

I would also strongly prefer having the ability to configure <Enter> to insert a newline in INSERT mode -- this way one could easily switch to a normal editor feeling to write complex prompts, before switching back to normal mode to send them when ready.

This would be a big improvement over my current workflow which goes something like:

  1. switch to INSERT mode
  2. write a line or two
  3. hit "Enter" by mistake when trying to move to a newline
  4. desperately slam the ESCAPE key a bunch of times hoping to catch Claude Code before my half-baked prompt gets sent
  5. try again.

But I also see the argument for why you would want to keep shift-enter behavior consistent and am grateful either way for making Claude Code available to the community in the first place. Just my 2 cents.

khughitt avatar Oct 06 '25 16:10 khughitt

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 08 '25 10:12 github-actions[bot]

Behavior remains unintuitive—I was excited to see that /vim exists but why would <enter> in INSERT mode send the prompt instead of newline? It's INSERT mode!

(Maybe the idea is streamlining, e.g., i /usage <enter>… but changing that to i /usage ESC <enter> makes sense. Heck, something like :/usage <enter> might make sense.)

Preferred behavior: INSERT mode: <enter> adds a newline and does not send prompt NORMAL mode: <enter> sends prompt

(As seen in the now-closed #898 and #1515. Per comment on #1515—this might be confusing behavior for people who accidentally happened to type /vim into Claude Code—but it does seem like the expectation for people who typed /vim on purpose.)

[CC v2.0.76 macOS 15.7.3 Terminal 2.14]

tnnrnet avatar Dec 23 '25 16:12 tnnrnet

+1 hitting enter in insert mode should not submit, it should create a newline. Would love for this to be fixed.

xanderdunn avatar Jan 12 '26 22:01 xanderdunn

+1 here as well. Having to use Alt+Enter to create a new line in INSERT mode is extremely unintuitive.

rewgs avatar Feb 05 '26 04:02 rewgs