Vim Tips Wiki

Merge longs lines that were split by terminal window

1,623pages on
this wiki
Add New Page
Add New Page Talk0

Sometimes I need to copy the output of a program running in the command prompt window and paste it as text.

If the output contains long lines they are split by the command prompt window and show up as 2 or more lines in the text editor after pasting.

This command detects such long line (as having exactly 80 characters, last character being non-space) and merges them into a single line.

g/^.\{79}\S$/normal Jx

Also on Fandom

Random Wiki