您的位置:首页 > 其它

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

2013-02-26 15:55 363 查看
(方法一)从文件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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐