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.
-
2It'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.– Tumbler41Commented May 23, 2018 at 17:57
-
3Also 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.– brhflCommented May 23, 2018 at 18:26
1 Answer
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.