我正在处理两个文件,我需要从一个文件复制几行并粘贴到另一个文件中。我知道如何在同一文件中复制(yy)和粘贴(p)。但这不适用于其他文件。
I am working with two files, and I need to copy a few lines from one file and paste into another file. I know how to copy (yy) and paste (p) in the same file. But that doesn't work for different files. How is this done?
还有,有什么方法可以剪切粘贴吗?我已经尝试过使用Google搜索,但是大多数资源都只讲复制粘贴。
Also, is there a way to cut-paste? I have tried googling, but most of the resources only talk about copy-paste.
推荐答案因为您已经知道如何剪切/删除文本,以下是将其粘贴回另一个文件的一些想法:
Since you already know how to cut/yank text, here are a few ideas for pasting it back into another file:
- 编辑第一个文件,提取所需的文本。然后从vi中打开第二个文件(:e / path / to / other / file )并粘贴
-
在拆分窗口中一起打开两个文件,然后使用 Ctrl + w , Up / Down 在两个文件之间导航:
- Edit the first file, yanking the text you want. Then open your second file from within vi (:e /path/to/other/file) and paste it
Open both files together in a split window and navigate between them using Ctrl + w, Up/Down either by:
- vi -o / path / to / file1 / path / to / file2
- 在第一个文件中, Ctrl + w , s
- vi -o /path/to/file1 /path/to/file2
- From within the first file, Ctrl + w, s
更多推荐
在Vi中将内容从一个文件复制并粘贴到另一个文件
发布评论