So, first, the breakdown on mappings and "timing out":
'timeout' boolean (default on)
'ttimeout' boolean (default off, set in |defaults.vim|)
These two options together determine the behavior when part of a
mapped key sequence or keyboard code has been received:
'timeout' 'ttimeout' action
off off do not time out
on on or off time out on :mappings and key codes
off on time out on key codes
[snipped]
Essentially, by default, vim will time out on :map
ped sequences and special key codes (like the <Esc>.
that is the equivalent of pressing <A-.>
).
You can control the length of said timeout with timeoutlen
and ttimeoutlen
:
'timeoutlen' number (default 1000)
'ttimeoutlen' number (default -1, set to 100 in |defaults.vim|)
The time in milliseconds that is waited for a key code or mapped key
sequence to complete. Also used for CTRL-\ CTRL-N and CTRL-\ CTRL-G
when part of a command has been typed.
Normally only 'timeoutlen' is used and 'ttimeoutlen' is -1. When a
different timeout value for key codes is desired set 'ttimeoutlen' to
a non-negative number.
ttimeoutlen mapping delay key code delay
< 0 'timeoutlen' 'timeoutlen'
>= 0 'timeoutlen' 'ttimeoutlen'
The timeout only happens when the 'timeout' and 'ttimeout' options
tell so. A useful setting would be
:set timeout timeoutlen=3000 ttimeoutlen=100
(time out on mapping after three seconds, time out on key codes after
a tenth of a second).
So it sounds like by default, you should get at least 1 second for mappings and key-codes alike, unless you're using the line from defaults.vim
such that key-codes only get 100s.
Options for a solution
- Disable timeouts entirely (
set notimeout nottimeout
)—personally, I don't recommend this, but YMMV.
- Enable timeouts on mappings as longer, and keycodes as shorter (
set timeoutlen=3000 ttimeoutlen=100
)—this is what I've been using and I've not had any issues. Your mapping works for me with this setup.
Understanding where the issue might be
Try running
verbose set timeout? ttimeout? timeoutlen? ttimeoutlen?
The results should be informative.
set notimeout
and check it it would work for you. (It did for me)