Subscribe for free with iTunes, Twitter, or RSS (Ogg or Quicktime).


Selecting columns with visual block mode


If you want to edit several adjacent lines with a similar format, you might save a lot of time by making a columnar selection. This episode will demonstrate how to achieve this using Vim’s visual block mode.


OGG 5.5 MB

Quicktime 8 MB

Visual block mode allows you to select a rectangular section of text. From normal mode, you can enter visual block mode by pressing ctrl-v.

In most text editing environments, if you want to replace some text, you can just start typing and the replacement will overwrite the selection. But Vim’s visual modes are similar to normal mode, in that each key will execute a command. Here are some of the commands covered in this episode:

command action
c change selection (delete and switch to insert mode)
I insert in front of cursor
A append after cursor
r replace every character in selection
d delete selection
o toggle cursor to opposite corner

Further Reading