MattCole3
MattCole3

Reputation: 155

What is the command to delete prior n lines in vi?

5dd will delete the next 5 lines.

Based on cursor position, is there a normal-mode command that will delete the prior n lines?

I've tried several non-working stabs, like $5dd, or !5dd (don't do that). Using Visual mode is not an answer.

Upvotes: 2

Views: 77

Answers (2)

Arkady
Arkady

Reputation: 15069

Something like this should work: deleting lines numbered (current-4) to (current-1):

:-4,-1d

Upvotes: 1

that other guy
that other guy

Reputation: 123570

The motion to move up a line is k, so 4dk

Upvotes: 4

Related Questions