Vim Scoops / Lessons / Visual block mode

How to select a column in Vim (visual block mode)

Press Ctrl+v to start a block selection, then move down and across to cover a column. Press d to delete it, or I, type, and Esc to add text to every line.

The keys

KeysWhat they do
Ctrl+vStart a block selection
dDelete the block
I … EscType before the block, on every line
$ then A … EscAppend to the end of every line
r + a characterReplace the whole block with that character

It's the quick way to comment out a run of lines, take a column of numbers off a list, or line things up.

The text you type with I only shows up on every line once you press Esc. Until then, it looks like it's only on the first.

Related

Want all of Vim, in order? Vim Scoops is a free game that starts at h j k l and builds up to macros.

Play the full game