VIM Powerful replication link

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.