How can I merge multiple lines into one line in Vim?

In command mode:

[range]j[lines]

For example: here you want to do the whole buffer:

%j

If you just wanted to do 10 lines from the current cursor position:

j10

If you don’t want to replace the new lines with spaces, use ! after j.

%j!
j!10

And for the uberfancy:

5j20

It would go to line 5, and join the next 20 lines.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)