如何使用缓冲区从文件1中复制(删除)并将(粘贴)到vi中的文件2中?

时间:2021-03-30 19:19:35

I want to know the process for copying data from file 1 and paste the data into file 2 in vi editor using a buffer.

我想知道从文件1复制数据并使用缓冲区将数据粘贴到vi编辑器中的文件2的过程。

Can you please tell me the step by step process.

你能告诉我一步一步的过程吗?

How to do that?

如何做呢?

1 个解决方案

#1


2  

From vi manual:

从vi手册:

6.5.6.3 Using Named Buffers

6.5.6.3使用命名的缓冲区

To repeatedly insert a group of lines in various places within a document, you can yank (or delete) the lines into a named buffer. You specify named buffers by preceding a command with double quotes (") and a name for the buffer. For example, to yank four lines into the named buffer a, type "a4yy. You can use several different buffers. For example, you might also delete text from one location and add it to several others. To delete 12 lines into the named buffer b, type "b12dd.

要在文档中的不同位置重复插入一组行,可以将这些行拖拽(或删除)到指定的缓冲区中。通过在具有双引号(")和缓冲区名称的命令前面指定已命名的缓冲区。例如,要将四行代码拖入指定的缓冲区a,输入“a4yy”。您可以使用几个不同的缓冲区。例如,您还可以从一个位置删除文本并将其添加到其他位置。要将12行删除到命名的缓冲区b中,输入“b12dd”。

To insert the text, precede the p or P command with n, where n is the named buffer. For example, to insert the lines saved in buffer b, type "bP.

要插入文本,请在p或p命令前面加上n,其中n是命名缓冲区。例如,要插入缓冲区b中保存的行,键入“bP”。

You can overwrite named buffers with new lines. The buffers are saved until you exit vi.

可以使用新行覆盖命名缓冲区。缓冲区被保存到退出vi为止。

When you use named buffers, you can safely delete and yank other text without affecting the lines you have already saved in the named buffers -- unless, of course, you purposely overwrite the named buffer.

当您使用命名缓冲区时,您可以安全地删除和删除其他文本,而不会影响已保存在命名缓冲区中的行——当然,除非您故意重写命名缓冲区。

#1


2  

From vi manual:

从vi手册:

6.5.6.3 Using Named Buffers

6.5.6.3使用命名的缓冲区

To repeatedly insert a group of lines in various places within a document, you can yank (or delete) the lines into a named buffer. You specify named buffers by preceding a command with double quotes (") and a name for the buffer. For example, to yank four lines into the named buffer a, type "a4yy. You can use several different buffers. For example, you might also delete text from one location and add it to several others. To delete 12 lines into the named buffer b, type "b12dd.

要在文档中的不同位置重复插入一组行,可以将这些行拖拽(或删除)到指定的缓冲区中。通过在具有双引号(")和缓冲区名称的命令前面指定已命名的缓冲区。例如,要将四行代码拖入指定的缓冲区a,输入“a4yy”。您可以使用几个不同的缓冲区。例如,您还可以从一个位置删除文本并将其添加到其他位置。要将12行删除到命名的缓冲区b中,输入“b12dd”。

To insert the text, precede the p or P command with n, where n is the named buffer. For example, to insert the lines saved in buffer b, type "bP.

要插入文本,请在p或p命令前面加上n,其中n是命名缓冲区。例如,要插入缓冲区b中保存的行,键入“bP”。

You can overwrite named buffers with new lines. The buffers are saved until you exit vi.

可以使用新行覆盖命名缓冲区。缓冲区被保存到退出vi为止。

When you use named buffers, you can safely delete and yank other text without affecting the lines you have already saved in the named buffers -- unless, of course, you purposely overwrite the named buffer.

当您使用命名缓冲区时,您可以安全地删除和删除其他文本,而不会影响已保存在命名缓冲区中的行——当然,除非您故意重写命名缓冲区。