Skip to content

Instantly share code, notes, and snippets.

@tlkahn
Created January 30, 2025 04:08
Show Gist options
  • Save tlkahn/32a1115a49d62dbed87c058b8a88dc03 to your computer and use it in GitHub Desktop.
Save tlkahn/32a1115a49d62dbed87c058b8a88dc03 to your computer and use it in GitHub Desktop.
line breaks in minibuffer of emacs

In Emacs, the minibuffer is typically used for single-line input, so pressing RET (Enter) usually submits the input. However, if you need to input a line break (newline) in the minibuffer, you can do so by using the following methods: Method 1: Use C-q C-j

Press C-q (quoted-insert), followed by C-j (newline).

This inserts a literal newline character into the minibuffer.

Method 2: Use C-o

Press C-o (open-line), which inserts a newline and moves the cursor to the new line.

Method 3: Use M-x newline

Type M-x newline and press RET. This will insert a newline at the cursor position.

Method 4: Use C-m

Press C-m (carriage return), which inserts a newline character.

Note:

Some minibuffer commands may not support multiline input, so the behavior might vary depending on the context. If the minibuffer doesn't allow multiline input, you may need to use a different buffer (e.g., a temporary buffer) for multiline text and then copy it back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment