7

What I want

To temporarily change the timeout value for certain key commands

Where I've looked

From :help 'timeout' I have :

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

I'm not sure how I would implement this in a key command though, or how to check the current setting of timeout.

For example, I wanted to try and set hh to go to the start of a line, but I wanted the timeout for that particular key command to be pretty quick, say 100 milliseconds.

What I've tried

:set timeout timeoutlen=100 ttimeoutlen=100
nmap hh <S-^>
:set timeoutlen=1000 ttimeoutlen=1000
  • 2
    Settings like 'timeoutlen' are used at the time that the mapping is invoked, not created. – tommcdo Mar 30 '15 at 10:53
1

The 'timeoutlen' option is a global one, and it applies at mapping invocation, not during definition.

I can understand your motivation (using a special hh mapping while still being able to quickly move via h, h), but I would nonetheless advise against such tricks. Better choose another mapping that doesn't overlap with a built-in command.

If you really must, have a look at the arpeggio plugin. It performs some tricks to map simultaneously pressed keys.

  • thanks Ingo, I'm getting a little more creative with mappings recently but still in need of do's and don'ts guidance :) – baxx Apr 1 '15 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.