【vim】复制一个文件中的数据到另一个文件中(使用缓冲区)

来源:互联网 发布:access2007制作数据库 编辑:程序博客网 时间:2024/05/30 19:34

(方法一)从文件a中复制4行数据到文件b中

vi a

"f4yy
:w
:e b
"fp

(方法二)

Another way to move text from one file to another is to use the ex commands :ya (yank)
and :pu (put). These commands work the same way as the equivalent vi commands
y and p, but they are used with ex’s line-addressing capability and named buffers.
For example:
:160,224ya a
would yank (copy) lines 160 through 224 into buffer a. Next you would move
with :e to the file where you want to put these lines. Place the cursor on the line where
you want to put the yanked lines. Then type:
:pu a
to put the contents of buffer a after the current line.

原创粉丝点击