VIM^s#02 Block or Vertical Select and Insert text

This is an amazing tip that I often needed especially while inserting comments on contiguous lines of code in VIM. Hence thought would keep a track of it.

To do a block select and insert some text in front of the select, do the following:

Move to the beginning of the line

enter the visual block mode by pressing Ctrl + v

select the lines you want by moving the up/down arrow keys

Press ‘I‘ (this is a capital ‘i’)

Enter the text you want to insert. Do not be paniced if you do not see the changes.

Press ‘Esc‘ key to see the changes to reflect on the screen.

There are other ways to do the same, probably the following link will add more value/reference to this blog.


About this entry