0

Can I map the Tab key as the same style as Control plus another key? For example ,<c-k> means press the Control and k keys together. I've tried <tab-k> but it didn't work.

2
  • 2
    It's worth noting that the only keys that can be used as modifiers (i.e. the first part of a multi-key mapping) are Alt, Ctrl, and Shift.
    – Tumbler41
    Commented May 23, 2018 at 17:57
  • 3
    Also worth a mention that (at least in a terminal), <Tab> is a control sequence; it is the same as <C-i>... It effectively already has a modifier on it.
    – brhfl
    Commented May 23, 2018 at 18:26

1 Answer 1

3

Assuming you mean "tab" not "tap"...


No.

This is not possible purely in vim. You are basically asking vim to recognize Tab as a modifier key. The only keys that vim recognize as a modifier key are Shift, Ctrl, Alt/Meta, and, on Mac, Command. (See :help keycodes.)

And since vim cannot recognize keyup/keydown events, you cannot use vimscript to handle tab presses and pretend it's a modifier key.

The only way you could achieve this would be by hacking your keyboard's firmware/drivers and making the tab button work differently, which is beyond my knowledge and way beyond the scope of a vim question. I don't know if you could bind it as a custom modifier or if you'd have to remap it to one of the existing modifier keys.

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.