Reference: http://blog.csdn.net/xiyuan1999/article/details/5680102
It is necessary to copy and paste entire lines (multiple lines) in the VI editor.
1. Copy
1) Single-line copy
In command mode, move the cursor to the line that will be copied, and press "yy" to copy;
2) Multi-line replication
In command mode, move the cursor to the first line that will be copied, press "Nyy" to copy n rows, where n is 1, 2, 3 ...
2. Paste
In command mode, move the cursor to the line you want to paste, and press "P" to paste
VI Ways to copy multiple lines of text
Method 1:
The cursor is placed on line 6th,
Input: 2yy
The cursor is placed on line 9th,
Input: P
This method is suitable for copying a small amount of text, and copying the 2 rows of data from line 6th (including) below line 9th.
Method 2:
Input in command line mode
6,9 Co 12
Copy the contents of lines 6th through 9th to the following line 12th.
Method 3:
Sometimes you don't want to struggle to see how many rows or large lines are copied, you can use labels instead
Move the cursor to the start line, enter the MA
Move the cursor to the end line, enter MB
Move the cursor to the pasted row, enter the MC
Then: ' A, ' B Co ' c changes the co into m and cuts it.
To delete multiple lines, you can use: 5, 9 de
VIM Powerful replication link