Learn Vim / How to Delete a Column of Text in Vim

How to Delete a Column of Text in Vim

The answerBlock-select the column with Ctrl-v, extend with j/l, then press d.

Try it on a real buffer

Strip the “> ” quote prefix from every line: Ctrl-v to start a block, 3j to the last line, l to widen it to two columns, then d.

> line one of the quote
> line two of the quote
> line three of the quote
> line four of the quote

Canonical solution: Ctrl-v 3j l d · par: 5 keystrokes (vimgolf rules — every keypress counts).

Why it works

A block selection deletes as a rectangle — perfect for prefixes, alignment gone wrong, or any column of junk. (:%s/^> // does it too, in more keys.)

Variations

KeysWhat it does
Ctrl-v 3j l ddelete a two-wide column across four lines
:%s/^> //the substitute-command equivalent for prefixes

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Column demolition” mission takes about a minute.

Practice free — no signup →

Keep going