Vim: How to insert in visual block mode?

前端 未结 4 1151
离开以前
离开以前 2020-12-12 11:58

How can you insert when you are in visual block mode (by pressing ctrl-V) in Vim?

4条回答
  •  醉话见心
    2020-12-12 12:24

    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
    

    You can visual block select before "W" and hit Shift+i - Type "Cool" - Hit ESC and then delete "World" by visual block selection .

    Alternatively, the cooler way to do it is to just visual block select "World" in both lines. Type c for change. Now you are in the insert mode. Insert the stuff you want and hit ESC. Both gets reflected with lesser keystrokes.

    Hello Cool 
    Hello Cool
    

提交回复
热议问题