I have a file which has lines longer than 72 characters terminated
with “+” and wrapped to the next line. How can I quickly join the lines? You can use the “:global” command to search and join the lines:
:g/+$/j
This will, however, only join every second line. A couple of more complex examples which will join all consecutive lines with a “+” at the end are:
:g/+$/,/\(^\|[^+]\)$/j
:g/+$/mark a | .,/\(^\|[^+]\)$/s/+$// | 'a,.j
Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.
Introduction to Recursion and Backtracking