How do I join two lines together in Vim?
J
The J command joins the current line with the line below it, replacing the newline with a space.
8 results for "join lines J"
J
The J command joins the current line with the line below it, replacing the newline with a space.
qaJjq
Record a macro that joins the current line with the next using J, then moves down one line with j.
gJ
The gJ command joins the current line with the line below it without inserting any space between them.
J (in visual mode)
In visual mode, pressing J joins all selected lines into a single line with spaces between them.
:'<,'>s/\n/, /g
Vim's J command joins lines with a single space, but sometimes you need a custom separator like a comma, pipe, or semicolon.
editing #editing #ex-commands #visual-mode #substitution #lines
gS / gJ
The splitjoin.
plugins #plugins #splitjoin #editing #refactoring #formatting
:g/start/,/end/d
The :g (global) command can operate on ranges, not just single lines.
:undojoin
When writing Vim scripts or running multiple Ex commands, each command normally creates a separate undo entry.