Kevin Colyar
Kevin Colyar

Reputation: 828

Vim Command Line Escape Timeout

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.

Upvotes: 8

Views: 3019

Answers (2)

Dan Stahlke
Dan Stahlke

Reputation: 1469

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")

Upvotes: 7

Leif Wickland
Leif Wickland

Reputation: 3724

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.

Upvotes: 0

Related Questions