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

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind