Delete newline in Vim Delete newline in Vim unix unix

Delete newline in Vim


If you are on the first line, pressing (upper case) J will join that line and the next line together, removing the newline. You can also combine this with a count, so pressing 3J will combine all 3 lines together.


Certainly. Vim recognizes the \n character as a newline, so you can just search and replace.In command mode type:

:%s/\n/


While on the upper line in normal mode, hit Shift+j.

You can prepend a count too, so 3J on the top line would join all those lines together.