In vi, J
(that's Shift + J) or :join
should do what you want, for the most part. Note that they adjust whitespace. In particular, you'll end up with a space between the two joined lines in many cases, and if the second line is indented that indentation will be removed prior to joining.
In Vim you can also use gJ
(G, then Shift + J) or :join!
. These will join lines without doing any whitespace adjustments.
In Vim, see :help J
for more information.