Vim multiline editing like in sublimetext?

后端 未结 7 1101
借酒劲吻你
借酒劲吻你 2021-01-29 17:15

I started to use gvim, and I can\'t quite understand how the multiline edit works in gvim.

For example:

Original text:

asd asd asd asd asd;
asd a         


        
7条回答
  •  逝去的感伤
    2021-01-29 17:51

    There are several ways to accomplish that in Vim. I don't know which are most similar to Sublime Text's though.


    The first one would be via multiline insert mode. Put your cursor to the second "a" in the first line, press Ctrl-V, select all lines, then press I, and put in a doublequote. Pressing will repeat the operation on every line.


    The second one is via macros. Put the cursor on the first character, and start recording a macro with qa. Go the your right with llll, enter insert mode with a, put down a doublequote, exit insert mode, and go back to the beginning of your row with (or equivalent). Press j to move down one row. Stop recording with q. And then replay the macro with @a. Several times.


    Does any of the above approaches work for you?

提交回复
热议问题