且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除vi中的多行?

更新时间:2023-12-03 12:01:10

听起来像是在命令模式(又名Ex 模式")下输入命令.在那种情况下 :5d 将删除第 5 行,仅此而已.为了使 5dd 按预期工作——也就是说,删除从光标开始的五个后续行——在正常模式下输入它,不要在命令前加上 :.

Sounds like you're entering the commands in command mode (aka. "Ex mode"). In that context :5d would remove line number 5, nothing else. For 5dd to work as intended -- that is, remove five consequent lines starting at the cursor -- enter it in normal mode and don't prefix the commands with :.