当前位置: 动力学知识库 > 问答 > 编程问答 >

linux - Deleting up to a certain line in Vim

问题描述:

I know that to delete n lines, the command is [n]dd, where n is the number of lines to delete.

But what if I want to delete up to a certain line number? Say, if I'm on line 65 and I want to delete up to line 126 without having to do the math, how could I do that?

网友答案:

d126G

Delete, line number, go.

A lot of commands in Vim can be followed by a move command to specify the scope.

网友答案:

Use this command:
65,126d

网友答案:
:.,126d

. is the actual line. If you want delete from the next line, you can use .+1 instead.

网友答案:
:,126d

all done.

分享给朋友:
您可能感兴趣的文章:
随机阅读: