如何删除vi中的多行? [英] How can I delete multiple lines in vi?

查看:34
本文介绍了如何删除vi中的多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试遵循以下几点:

如何在 VI 编辑器中删除选中的文本

但是

5dd

给予

E492:不是编辑器命令:5dd

E492: Not an editor command: 5dd

然后我尝试了:

5d

它只删除一行.如何删除多行?

Which only deletes a single line. How can I delete multiple lines?

推荐答案

听起来像是在命令模式(又名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 :.

这篇关于如何删除vi中的多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆