The conventional idea is to open two vim and then do the YY and P operations, but the practice proves that it doesn't work at all. At this point, we need to split the window and then we can copy and paste. The steps are as follows:
Suppose I want to copy the ReadLine function of the srv.c file to the Cli.c file as a whole.
1. Split: Open srv.c at this point, then enter SP under command interface
2. Open: Enter e cli.c, this opens the CLI.C
3. Switch window: ctrl+w+ the arrow keys (up or down) to switch windows.
4. Make a valid copy: If you want to copy a function to another window, you can do the following
- Find the beginning: "{" To find the function entry or exit, enter shift+v into the visualization mode
- Pull the mouse wheel to the end of the function you want to copy
- Make a regular copy of YY
- Ctrl+w+ arrow keys (up and down) switch back to CLI.C, select the appropriate location, paste P
Original link: http://blog.csdn.net/u010296036/article/details/70591639
Copy content between two different vim