在vim中意外输入:W1而不是:WQ
我经常不小心输入:在VIM中而不是:WQ。在这种情况下,创建了名称1的文件。
有什么方法可以防止这种情况吗?
very often I accidently enter :w1 in vim and not :wq. In that case a file with the name 1 is created.
Is there any way to prevent this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AS phd 评论说,您可以创建一个命令行缩写:
也可以使用 ZZ 退出,
您 还可以考虑当前的缓冲区,就好像是刮擦缓冲区一样,并删除所有内容:
As phd commented you can create a command line abbreviation:
You can also exit using ZZ:
You can also consider the current buffer as if it was a scratch buffer and discar everything: