Vim Command Line Escape Timeout

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

I'm having an issue with a delay when using <Esc> or <C-[> to get out of command line mode. It appears that vim is waiting to see if I'm going to enter a keymapping, and I've changed my ttimeoutlen and it doesn't change the delay but it's not really what I want. I'd prefer not to have any delay

I've done a :map to see if there are any mappings that expect a <Esc>... or <C-[>... but don't see any that do.

回答1:

Along with setting ttimeoutlen, do you also set ttimeout? This is needed to turn the feature on. I have the following in my .vimrc:

set ttimeout set ttimeoutlen=100 

Now I get no delay after ESC (even when running without the GUI), even though I have maps that involve ESC. For example:

if !has("gui_running")     set <A-v>=<1b>v endif  inoremap <A-v> <C-o>"+p 

(note the <1b> above was written using "Ctrl-v ESC")



回答2:

To expand upon the comment @AdeYU posted on the question, the vim reference for maps says there are three different kinds of mapping that can affect the command-line:

  • :map
  • :cmap
  • :lmap

You'd have to check all three to rule out a mapping as the cause of your problem.

Update: Despite what the docs seem to indicate, if I create an imap that begins with escape, then hitting escape while in command-line mode does suddenly take longer to respond. I guess you'd have to clear out the imaps too.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!