I have a very customized vim configuration, but I don't think it has anything to do with this, because nothing has changed the key binding system.

When I press g I can leave the window there and make a sandwich and come back and it's still shown in the part of my statusbar that shows pending keystrokes (I forget what that is called).

But when I press \ (<Leader>) it times out and beeps after one second.

When I check maps, I see that neither g nor \ have primary mappings to just that key (which would indeed cause them to trigger their mapping upon timeout or receiving another non-matching key).

So what then is the difference between these two cases? Why doesn't \ leave me more time, or, why does g not time out?

  • Have you set either of timeoutlen or ttimeoutlen?
    – muru
    Aug 11, 2015 at 6:47
  • Yes and it shouldn’t matter because both keys should be affected by that setting in the same way
    – Steven Lu
    Aug 11, 2015 at 15:17
  • I suppose this must be because <leader> always begins mappings, but g can begin Vim commands as well. (There's an entire section dedicated to "Commands starting with g".) Similar effect for ], q
    – muru
    Aug 11, 2015 at 16:03
  • i'll see if I can find other examples of keys that behave like g does
    – Steven Lu
    Aug 11, 2015 at 16:05
  • 1
    According to :h ttimeout when timeout is off and ttimeout is on then Vim times out on key codes but not on mappings, could it be your situation?
    – statox
    Aug 11, 2015 at 19:30

1 Answer 1


Certain commands such as g, z, f or Ctrl-W expect another key afterwards. Those commands will call plain_vgetch() internally, which is a function that loops and waits until it receives a key (and ignores certain internal key events such as Scrollbar or Ignore events). By setting some additional global variables, it will be made sure, that those keys won't be mapped and the plain keycode will be returned. But depending on the command, the languange maps might apply.

What will be done, depends on the flags for the normal mode commands (see the definition of the nv_cmd struct in normal.c). The NV_NCH* flags mean that another char needs to be obtained.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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