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
| Keys | What they do |
|---|---|
| Ctrl+v | Start a block selection |
| d | Delete the block |
| I … Esc | Type before the block, on every line |
| $ then A … Esc | Append to the end of every line |
r + a character | Replace 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