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.