vim column selection

vim_compThere are many editors which support column mode selection. It comes handy in many situations e.g. when you want to remove the preceding line numbers before each line in a code snippet. To do this in vim:

  1. Open the file
  2. Press <v> to enter visual mode
  3. Press <Ctrl-v> to enter the block selection mode
  4. Use the arrow keys to select all the text you want
  5. Press <Del> to remove the selection, <y> to yank (copy), <c> to cut

To insert spaces or shift a block towards right by spaces:

  1. Press <Ctrl-v> to enter the block selection mode
  2. Select the first column of each line
  3. Press <Shift-i> for block insertion
  4. Insert space(s)
  5. <Esc> to normal mode

Comment

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

WordPress.com Logo

You are commenting using your WordPress.com 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