7.7 Blank Lines
Here are special commands and techniques for inserting and deleting blank lines.
C-o
​
Insert a blank line after the cursor (open-line
).
C-x C-o
​
Delete all but one of many consecutive blank lines (delete-blank-lines
).
We have seen how RET
(newline
) starts a new line of text. However, it may be easier to see what you are doing if you first make a blank line and then insert the desired text into it. This is easy to do using the key C-o
(open-line
), which inserts a newline after point but leaves point in front of the newline. After C-o
, type the text for the new line.
You can make several blank lines by typing C-o
several times, or by giving it a numeric argument specifying how many blank lines to make. See Arguments, for how. If you have a fill prefix, the C-o
command inserts the fill prefix on the new line, if typed at the beginning of a line. See Fill Prefix.
The easy way to get rid of extra blank lines is with the command C-x C-o
(delete-blank-lines
). If point lies within a run of several blank lines, C-x C-o
deletes all but one of them. If point is on a single blank line, C-x C-o
deletes it. If point is on a nonblank line, C-x C-o
deletes all following blank lines, if any exists.