Column (block) insert/delete on VIM

I know this is not new information at all, but every time I have to insert some text at some specific index for a group of consecutive strings I have to google something like “column insert VIM” (surprisingly, the title of this post) and search through the first 5 results for the correct solution. Well, the one I happen to understand, anyway…

So, here’s how it’s done:

  1. move the cursor to the uppermost character (if you’re selecting lines the way down, bottom if you’re going up)ย before which you want to insert text
  2. enter Visual Block Mode by pressing Ctrl+v (unless you mapped the paste action to it, in which case you probably already know how to column insert)
  3. select the column using the arrow keys
  4. press Shift+i (switching into Insert Mode)
  5. type the text you want to insert (will be displayed only on the first line)
  6. press esc two times
  7. ?????
  8. Profit!

In case you want to deleteย text, follow steps 1 through 3 and simply select all text you wish to delete, then press x and you’re done!

7 thoughts on “Column (block) insert/delete on VIM

  1. Thank you! Learnt about shift+i in visual block mode!

    I would encourage the use of hjkl keys for basic navigation using Vim to really start reaping the benefits of Vim.

    Nonetheless, nice post!


    • you’re welcome ๐Ÿ™‚

      … about using the hjkl keys, yeah, I know true Vim users use them all the time, but I never got to make the big jump from arrow keys… I’ll try again!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s