如何禁用vim中的内置命令 [英] How to disable a built-in command in vim

查看:216
本文介绍了如何禁用vim中的内置命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vim中,当我点击:wq 时,尝试输入时几乎总是发生意外:w 。我想禁用:wq

In vim, when I hit :wq it is almost always an accident that occurred when attempting to input :w. I would like to disable :wq.

我发现的最近的是 code>,但它有一些奇怪的行为。如果我做了

The closest I found is cmap, but it has some odd behavior. If I do something like

:cmap wq w

我不能再输入:wq ;它只是在命令模式下将键击序列 wq 重新映射到 w 。现在我不能,例如,在包含 wq 的字符串上输入search / replace命令。

I can no longer even input :wq; it just remaps the keystroke sequence wq to w in command mode. Now I cannot, for example, input a search/replace command on a string containing wq.

喜欢将确切的命令:wq 别名到:w 或无操作。有没有办法做这个?

I would just like to alias the exact command :wq to :w or a no-op. Is there a way to do this?

编辑:澄清为什么:cmap p>

clarified why :cmap is not an option for me

推荐答案

看起来最好的选择只是习惯于:cmap 行为。在罕见的情况下,我想输入键盘序列 wq 我可以直接点击 wq ,等待一秒, q 。我找到了这个可能的解决方案,但对我来说太复杂了口味。

It looks like the best option is to just get used to :cmap behavior. In the rare event I want to input the keyboard seqeunce wq I can just hit wq, wait a second, then hit q again. I did find this possible solution but it is too complex for my tastes.

这篇关于如何禁用vim中的内置命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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