Video Lesson: Write multi-line prompts in Claude Code

Write multi-line prompts in Claude Code

Learn how to write multi-line Claude Code prompts using Option+Enter and terminal keyboard settings.


Lesson Content

You type a prompt into Claude Code, press Enter, and it sends. This is how basic interactions work. But if you send in a lot of instructions, most prompts won't fit into a single line, and you'll want to use some newlines.

There are a few ways to do this. The first is the default: type a backslash and then press Enter. This will create a newline, but you'll need to type it every single time.

Another option is Ctrl+J. This is Claude Code's default shortcut for inserting newlines, but it's... awkward, especially on my mechanical keyboard.

I wanted something more intuitive, so we'll need to dig a bit deeper. What we're after is Option+Enter. On Windows and Linux that's Alt+Enter, and it most likely already works -- this is a Mac problem.

Turn the Option key on

Press Option+Enter in Claude Code right now and, on most Macs, nothing happens. You might get an accented character instead.

That's not Claude Code's fault. On macOS, most terminals don't send Option to the application as a modifier at all -- they use it for typing special characters, the way it works everywhere else on your Mac. Claude Code is listening for that keystroke, but your terminal never passes it along.

The setting that fixes this is labeled Use Option as Meta Key. Meta is just the old Unix name for the key we now call Option or Alt, so don't let the wording throw you -- that checkbox is the one you want. Where you find it depends on your terminal:

  • Apple Terminal -- run /terminal-setup inside Claude Code and it flips the setting for you. You can also do it by hand under Settings -> Profiles -> Keyboard.

  • iTerm2 -- Settings -> Profiles -> Keys -> General, then set both the Left Option key and the Right Option key to Esc+.

  • VS Code or Cursor -- add "terminal.integrated.macOptionIsMeta": true to your settings.

Restart your terminal

After changing your terminal's configuration, you'll need to restart the terminal app. This is especially true if you're on Apple Terminal and just ran /terminal-setup.

So let's quit Terminal completely -- be sure to exit the entire app, not just close the window -- and open it again. Then start Claude Code.

Now type a line and press Option+Enter, and you'll get a line break. Use it as many times as you want, add as much extra info as the thought needs, and when you're ready to send, just tap Enter to submit the whole message.

What about Shift+Enter?

Every other chat app uses Shift+Enter for this, and it's what I've been using in Claude Code's desktop app. I tried to set it up here too, and it turns out you can't -- at least not in Apple Terminal.

Ghostty, Kitty, iTerm2, WezTerm, and Warp can all tell Shift+Enter apart from a plain Enter, so it works there with no setup. Apple Terminal, gnome-terminal, and the JetBrains IDEs can't. As far as they're concerned the two keystrokes are identical, so Claude Code only ever sees a plain Enter and submits your prompt. There's no setting to fix it, because that keystroke never leaves the terminal.

Option+Enter doesn't have that problem, which is why we just use that instead.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Log in for AI tutor access.

Comments

Join the discussion!

Notes

Keep track of what you learn!