Delete lines in vi

vi or vim (vi improved) has powerful ways to delete line. This post gives some examples.

The command for delete is :d. Delete current line


Delete line 10


Delete from start to line 30


Delete from line 50 to end ($)


Delete blank line (:g will execute a command on lines which match a regex. The regex is ‘blank line’)