Vim Recall繁體中文

Join lines with spacing

J

Example

Normal 0 / 1
red
blue
Cursor on line 1, column 1

Join the current line and the line below.

Before & after
Before
red
blue
Cursor on line 1, column 1
After
red blue
Cursor on line 1, column 4

Start in Normal mode. Cursor starts on r. Press J; ordinary words need one separating space.

Details & Vim help

Example replayed in Vim

Join the current line and the line below.

J removes the newline and the next line’s leading indentation, adding spacing when needed. joinspaces and formatoptions can affect that spacing. A count joins that many lines, with a minimum of two.