Vim: insert the same characters across multiple lines

后端 未结 12 1906
慢半拍i
慢半拍i 2020-11-29 14:23

Sometimes I want to edit a certain visual block of text across multiple lines.

For example, I would take a text that looks like this:

name
comment
ph         


        
12条回答
  •  萌比男神i
    2020-11-29 14:48

    You might also have a use case where you want to delete a block of text and replace it.

    Like this

    Hello World
    
    Hello World
    

    To

    Hello Cool
    
    Hello Cool
    

    You can just visual block select "World" in both lines.

    Type c for change - now you will be in insert mode.

    Insert the stuff you want and hit escape.

    Both get reflected vertically. It works just like 'I', except that it replaces the block with the new text instead of inserting it.

提交回复
热议问题