列复制并粘贴到行中 [英] column copy and paste in row

查看:42
本文介绍了列复制并粘贴到行中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下内容的文件:

I have a file with follow content:

    sensor_write_reg(client,0x57,0x00);
    sensor_write_reg(client,0x58,0x00);
    sensor_write_reg(client,0x59,0x00);
    sensor_write_reg(client,0xfe,0x00);
    sensor_write_reg(client,0x46,0x00);

我想将以下文本列复制到一个新文件中:

I want to column copy the following text to a new file:

struct reg reg_table[] =
{
// paste here
}

int a;
int b;
int c;
// ...

the following content expected:
struct reg reg_table[] =
{
0xfe,0x01   
0x54,0x11
0x55,0x03
0x56,0x00
0x57,0x00
0x58,0x00
0x59,0x00
0xfe,0x00
0x46,0x00
}

int a;
int b;
int c;
// ...

在源文件中,我输入 CTRL+v 进入列模式,选择并复制.键入 CTRL+W 进入目标文件,然后键入 p 进行粘贴.但是,粘贴的内容会覆盖以下语句.那不是我想要的.

In the source file, I type CTRL+v to enter column mode, select and copy. Type CTRL+W to enter the destination file, and type p to paste. However, the pasted content overrides the following statements. That's not I want.

0xfe,0x01
0x54,0x11}
0x55,0x03int a;
0x56,0x00int b;
0x57,0x00int c;
0x58,0x00

有没有办法以行模式将其粘贴到多行新行中?

Is the any way to paste it in row mode, in a number of new lines?

推荐答案

始终粘贴某些内容,您可以使用 :put 命令.

To always paste something linewise you can use the :put command.

:put

如果你想转换为字符或块,你可以使用 setreg() 函数,如下所示 vim 提示 或使用这个插件,UnconditionalPaste.

If you want to convert to characterwise or blockwise you can use the setreg() function as shown in this vim tip or use this plugin, UnconditionalPaste.

这篇关于列复制并粘贴到行中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆