Created
October 1, 2016 19:54
-
-
Save justinmk/6fbf991a7f7312487110d11ade1d50e0 to your computer and use it in GitHub Desktop.
Vim t_xx option snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #define TERMCAP2KEY(a, b) (-((a) + ((int)(b) << 8))) | |
| #define KEY2TERMCAP0(x) ((-(x)) & 0xff) | |
| #define KEY2TERMCAP1(x) (((unsigned)(-(x)) >> 8) & 0xff) | |
| int main(int argc, char **argv) { | |
| int t_vi = TERMCAP2KEY('v', 'i'); | |
| unsigned int keyname[2] = { 0 }; | |
| keyname[0] = KEY2TERMCAP0(t_vi); | |
| keyname[1] = KEY2TERMCAP1(t_vi); | |
| printf("t_vi=%d keyname0=%d keyname1=%d\n", t_vi, keyname[0], keyname[1]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment