简体   繁体   中英

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? 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. 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

(2) Shift + Alt + I to put a cursor at the end of each line

(3) Home to move all those to the beginning

Then you'll need to bind this command

cursorWordPartRight

to some keybinding. Trigger that keybinding and type your , .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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