Daily common to multi-line merging functions, recorded as follows:
First, multiple lines are merged into one line, namely:
AAAAA
bbbbb
Ccccc
Merge to:
AAAAA bbbbb CCCCC
Method 1:normal State 3J where 3 is a range, can be a bookmark or search location, and other ways to implement, J for merging
Note: If you change to 3gJ, the rows do not have blank aaaaabbbbbccccc at the time of merging, similar to the following method, the difference between the two merging methods is not repeated.
Method 2: Command state: 1,3 join or: 1,3 J
Method 3: The traditional point, the way to replace the newline character, in order to avoid the last line is also replaced, the scope is reduced, the command state: 1,2s/\n//
The second, interlaced merging, namely:
AAAAA
bbbbb
Ccccc
Ddddd
Merge to:
AAAAA BBBBB
CCCCC ddddd
Method 1: Borrow the macro recording function, the normal state QAJJQ implementation recording, and then repeated in the appropriate area n times, here 2 times, normal state [email protected]
Method 2: Command state: 1,4g/^/join adds a G filter and merges into an interlaced process
Vim merge rows