简体   繁体   English

如何告诉 vim 忽略命令类型错误并且不要进入插入模式

[英]How to tell vim to ignore commands type error and do not drop into insert mode

I use vim with Youcompleteme .我将 vim 与Youcompleteme一起使用。

I set some key maps in.vimrc, for example:我在.vimrc中设置了一些键映射,例如:

let mapleader=','
nmap <leader>imp :YcmCompleter GoToImplementation<CR>

My whole.vimrc is here , it's a bit of messy.我的 whole.vimrc 在这里,有点乱。

sometimes I mistype ",imp" to ",im", or other mistypes.有时我将“,imp”输入错误为“,im”,或其他错误输入。 And vim behaves strange.而 vim 的行为很奇怪。 I uploaded an ascii recording here .在这里上传了一段 ascii 录音。

My question is how to tell vim to ignore commands if not matched against any key maps I set in.vimrc?我的问题是如果与我在.vimrc 中设置的任何键映射不匹配,如何告诉 vim 忽略命令?

You can map any common undesired lead-ins to do nothing:您可以 map 任何常见的不受欢迎的引入线什么都不做:

nnoremap ,imp :YcmCompleter GoToImplementation<CR>
nnoremap ,im <esc>

You can obviously not map any mistypo to be ignored.您显然不能忽略 map 的任何错误。 You would for instance still like imp to insert mp例如,您仍然希望imp插入mp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM