可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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:
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.