Vim Recall繁體中文

Join lines without changing spaces

gJ

Example

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

Remove the newline without adjusting whitespace.

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 gJ; the two original leading spaces remain.

Details & Vim help

Example replayed in Vim

Remove the newline without adjusting whitespace.

gJ joins the current and next line without adding spaces or removing indentation. A count joins that many lines, with a minimum of two.