Vim - 在插入模式下删除行 [英] Vim - delete line in insert mode

查看:36
本文介绍了Vim - 在插入模式下删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在插入模式下删除一行吗?

Can I delete a line in insert mode?

因为目前我必须按 <ESC>dd 才能做到这一点,我想要一种更快的方法来在插入模式下删除一行

Because currently I have to press <ESC>dd to be able to that, and I would like a quicker way to delete a line in insert mode

推荐答案

如果光标在行尾,可以按两次.第一个将清除光标前的文本,第二个将删除现在的空行(并将光标放在上一行的末尾).

If the cursor is at the end of the line, you can press <C-U> twice. The first one will clear the text before the cursor, the second one will remove the now empty line (and put the cursor at the end of the previous line).

也就是说,我不会经常使用它.插入模式用于插入;对于所有其他编辑,最好退出插入模式并使用普通模式 dd 代替.大多数高级用户快速进入和退出各种模式;这就是他们的目的.不要在插入模式下逗留太久.我什至因为超过几秒钟的思考暂停"而退出它.

That said, I would not use this often. Insert mode is for inserting; for all other edits, it's better to exit insert mode and use normal mode dd instead. Most power users quickly move into and out of various modes; that's what they were made for. Don't linger in insert mode for too long. I even exit it for "thinking pauses" of more than a few seconds.

这篇关于Vim - 在插入模式下删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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