gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Bug Report: Gemini-CLI Line Break Issue

Open wildcatDownstairs opened this issue 1 year ago • 18 comments

What happened?

I attempted to create line breaks in gemini-cli using Shift + Enter and \n in my input prompts, but neither method worked as expected. When I pressed Shift + Enter, the command was submitted instead of adding a new line. Additionally, using \n in the input did not result in proper line breaks in the output, causing formatting issues. This behavior persists across multiple attempts with multi-line prompts or code inputs.

What did you expect to happen?

I expected Shift + Enter to insert a new line without submitting the command, similar to other CLI tools. Alternatively, I anticipated that including \n in the input would generate correct line breaks in the output, ensuring proper formatting for multi-line text or code.

Client information

v0.1.7 Windows11

Login information

No response

Anything else we need to know?

No response

wildcatDownstairs avatar Jun 29 '25 05:06 wildcatDownstairs

Due to terminal limitations, you can't use Shift+Enter or Ctrl+Enter for line breaks. To insert a line break, please type a backslash followed by Enter.

yusei-murai avatar Jun 29 '25 14:06 yusei-murai

@yusei-murai Thanks for this. It works but I swear SHIFT+ENTER was working yesterday as I did it countless times. I'm running Rovo side-by-side with Gemini & Gemini was working with SHIFT+ENTER just 2-3 days ago but I love \+Enter too although a bit unintuitive.

deadcoder0904 avatar Jul 02 '25 10:07 deadcoder0904

Well that works in claude code just fine - why can't gemini cli make it work?

leonk-sportsbet avatar Jul 03 '25 01:07 leonk-sportsbet

/help should list the working methods of creating a newline, but there is also an open issue to make shift+enter work.

Closing as duplicate. If you think this is a different problem, please reopen with more clarifications. Thanks!

olivi-eh avatar Jul 03 '25 18:07 olivi-eh

Still the shift+enter not working.

Ritik-in-Tech avatar Jul 05 '25 04:07 Ritik-in-Tech

Still the shift+enter not working.

Correct, there's an open bug for this, which I've linked: #849

olivi-eh avatar Jul 07 '25 14:07 olivi-eh

Due to terminal limitations, you can't use Shift+Enter or Ctrl+Enter for line breaks. To insert a line break, please type a backslash followed by Enter.

This method DOES NOT WORK In the latest version:0.1.10.

vber avatar Jul 11 '25 08:07 vber

Due to terminal limitations, you can't use Shift+Enter or Ctrl+Enter for line breaks. To insert a line break, please type a backslash followed by Enter.

This method DOES NOT WORK In the latest version:0.1.10.

Yes, I confirm that [\ ENTER] for new line is gone in the new update. Shift Enter, Ctrl Enter also not working

xJuggl3r avatar Jul 11 '25 12:07 xJuggl3r

try Ctrl+j

gjf7 avatar Jul 12 '25 14:07 gjf7

@gjf7 thanks for your answer. ctrl+J works, but it is uppercase J

(macosx)

gcgbarbosa avatar Jul 14 '25 11:07 gcgbarbosa

Ctrl+j (lowercase) is working in ubuntu linux

maxrossello avatar Jul 17 '25 10:07 maxrossello

It is not working on powershell (ctrl+j, ctrl+J, shift+ENTER, ctrl+ENTER, \ followed by ENTER). None of these works.

vhcg77 avatar Jul 18 '25 00:07 vhcg77

It is not working on powershell (ctrl+j, ctrl+J, shift+ENTER, ctrl+ENTER, \ followed by ENTER). None of these works.

None of these works in mac too.

quanru avatar Jul 18 '25 10:07 quanru

control+j is working on macOs.

choijero avatar Aug 06 '25 22:08 choijero

Alt+Enter is working on Ubuntu

sco09 avatar Nov 03 '25 15:11 sco09

Alt+Enter is also working on Windows 11 with WSL-connected gemini-cli (e.g. within VScode)

be-nj avatar Nov 11 '25 03:11 be-nj

@yusei-murai

Due to terminal limitations, you can't use Shift+Enter or Ctrl+Enter for line breaks. To insert a line break, please type a backslash followed by Enter.

I'm not sure this is entirely true. For me, in Claude Code, Shift + Enter worked for newlines out of the box (I didn't have to change any settings or anything). Clearly it can be done. Maybe it's a quirk of my particular setup? I use Warp.

tomarshall avatar Nov 18 '25 16:11 tomarshall

Since this is such a common use case it would be great in the meantime to have this above the prompt, or as a placeholder when the prompt is empty, or as one of those purple loading 'jokes'. There's probably a heap of useful stuff you could put there which would really improve the ways user are able to interact with the product.

kiranmarshall avatar Dec 02 '25 03:12 kiranmarshall