Brisk Vim (5): copying

Source: Internet
Author: User

Copying the same text is particularly effective. In Windows, we are used to choosing text with the mouse.

In vim, you don't have to worry about it. You can even use the visual mode for operations, but skip this step.

In this section, I will talk about the replication in command mode.

 

Before talking about replication, I want to start with a simple command that doesn't work.

Paste
 
P Paste

There are many copies, but there are not many paste forms.

It's nothing more than adding numbers to paste posts multiple times.

In fact, to be accurate, P should be the meaning of placement.

But I don't know whether it's paste or put.

 

Word and character Replication
 
Ynl copy n characters to the right ynh copy n characters to the left ynw copy n words forward YNB copy n words backward

Because the replication operation is usually performed when the volume is large

So here I use N instead of the number of operations

It seems that it doesn't make much sense here.

Because complex characters and words are not directly inserted

 

Row Replication
Copy y0 to the beginning of the row y $ copy to the end of the row YY copy the entire row YH copy from the current row to the top of the screen yl copy from the current row to the bottom of the screen

Here, the first two are rarely used.

However, full-row or multi-row replication is convenient for yy.

TIPS:1. 4yy, that is, copying four rows

2. y can be used with almost any cursor movement command. Try it if you don't believe it.

 

Cut

Copy. Here, let's also talk about the cut command.

In fact, cut is very simple, that is, first delete, and then press P to paste the post

For example, after dd deletes a row, this row will be placed in the buffer zone.

Move to the location you want to place and press P to paste the post.

 

 

 

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.