Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

VIM Block Editing

Selecting blocks of text is one of the more powerful reasons to use an editor such as VIM, it allows the easy removal of a chunk of text in the middle of various lines. This in itself may not seem all that useful but consider a readout where the first column is always junk. With this tip you can easily remove it.

Go to the first character you want to select in the block.

Press Ctrl + q to enter Visual Block mode.

Now, use the 'hjkl' keys to move around instead of the arrow keys or the mouse which will select whole lines rather than just the block.

  • H - Left
  • I - Down
  • J - Up
  • L - Right

Now copy or delete as preferred.

(Tested on Vim 6.2 Microsoft Windows)

Share this!