Vim - Delete column
Nov 26, 2011·
·
1 min read
Julio Batista Silva

One of the great advantages of Vim over other editors is that it has various visual modes that allow editing text blocks involving multiple lines.
Today I needed to delete the characters from column 5 to column 10 of a file that were between lines 20 and 30.
An alternative would be to use regular expressions, but in Vim, this can be done in a much less complex way.
Vim has several visual modes:
v:--VISUAL--V:--VISUAL LINE--<C-v>:--VISUAL BLOCK--
The latter was the solution to my problem.
- Just go to line 20 column 5 (start of the block)
- Type
ctrl+v - Type 10 (number of lines in the block)
- Using the
lkey or the arrow keys, select up to column 10 (end of the block) - Delete the block using the
dcommand.