简体   繁体   English

使用多光标在多行的不同列中插入文本

[英]Using multi-cursor to insert text at different columns on multiple lines

I am using VS Code (with vim plugin), how would I insert text after the first word of each sentence on multiple lines?我正在使用 VS Code(带有 vim 插件),如何在多行每个句子的第一个单词后插入文本? I would like to know how to do this strictly with multi-cursor, not macros, search/replace, etc.我想知道如何使用多光标严格执行此操作,而不是宏、搜索/替换等。

I would like to turn this:我想转这个:

Hi how are you?
Ahoy how are you?
Howdy how are you?

into this:进入这个:

Hi, how are you?
Ahoy, how are you?
Howdy, how are you?

Use a single command使用单个命令

:%norm ea,

: ................... command mode
% ................... whole file
norm  ............... normal mode
e  .................. end of a word
a  .................. append charactere

The easiest is to select your lines with Selection/Column Selection Mode enabled.最简单的方法是选择启用了Selection/Column Selection Mode Select the first column (there are other ways to get a cursor at the beginning of each of your selected lines - such as选择第一列(还有其他方法可以在每个选定行的开头获取光标 - 例如

(1) Select all your lines (1) 选择所有线路

(2) Shift + Alt + I to put a cursor at the end of each line (2) Shift + Alt + I将光标放在每行的末尾

(3) Home to move all those to the beginning (3)家庭将所有那些开始

Then you'll need to bind this command然后你需要绑定这个命令

cursorWordPartRight

to some keybinding.到一些键绑定。 Trigger that keybinding and type your , .触发该键绑定并键入您的,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM