Tags

, , , ,

These three methods may be used to copy some text in the vim buffer, which may then be pasted in another vim session. All the operations in vim are done in the normal mode.

Method 1:
1. "f3yy — yank 3 lines into buffer f
2. go to the other file opened using vim
2. "fp — paste the contents of buffer f

Method 2:
1. :100,200ya f — yank lines 100 through 200 to buffer f
2. go to the other file opened using vim
3. :pu f — paste the contents of buffer f

Method 3: (visual mode)
1. Select the code using any of v, V, or ^V
2.Copy into the X clipboard: "*y
3.Switch to the other vim
4. "*p

Advertisements