Joining Lines

J joins the next line to the current. gJ joins without a space.

Keys: J, gJ

J joins the line below to the current line, replacing leading whitespace with a single space (and removing comment leaders intelligently). gJ joins literally, with no whitespace fixup.

J joins the line below to the current line. By default it inserts a single space and trims leading whitespace from the joined line โ€” almost always what you want for prose and code.

Join next line (smart: replaces whitespace with space)
KeyNote
J
Join next line (literal: no whitespace handling)
KeyNote
g
J
Join 3 lines into one
KeyNote
3
J
J โ€” join lines
gJ โ€” literal join

Worked example โ€” J

Join two lines into one.

Step 1 ยท
transform.join
Step 2 ยท J ยท J โ€” joined with a single space.
J โ€” joined with a single space.

gJ joins without adding a space โ€” useful for code.

โ–ถ Try this in the simulator

See also: Line Motions