keycodes.h
Go to the documentation of this file.
1 #ifndef NVIM_KEYCODES_H
2 #define NVIM_KEYCODES_H
3 
4 #include "nvim/strings.h"
5 
6 // Keycode definitions for special keys.
7 //
8 // Any special key code sequences are replaced by these codes.
9 
10 //
11 // For MS-DOS some keys produce codes larger than 0xff. They are split into two
12 // chars, the first one is K_NUL.
13 //
14 #define K_NUL (0xce) // for MS-DOS: special key follows
15 
21 #define K_SPECIAL (0x80)
22 
27 #define IS_SPECIAL(c) ((c) < 0)
28 
31 #define ABBR_OFF 0x100
32 
35 #define KS_ZERO 255
36 
39 #define KS_SPECIAL 254
40 
43 #define KS_EXTRA 253
44 
47 #define KS_MODIFIER 252
48 
49 // These are used for the GUI
50 // K_SPECIAL KS_xxx KE_FILLER
51 
52 #define KS_MOUSE 251
53 #define KS_MENU 250
54 #define KS_VER_SCROLLBAR 249
55 #define KS_HOR_SCROLLBAR 248
56 
57 // Used for switching Select mode back on after a mapping or menu.
58 
59 #define KS_SELECT 245
60 #define K_SELECT_STRING (char_u *)"\200\365X"
61 
62 // Used a termcap entry that produces a normal character.
63 #define KS_KEY 242
64 
65 // Used for click in a tab pages label.
66 #define KS_TABLINE 240
67 
68 // Used for menu in a tab pages line.
69 #define KS_TABMENU 239
70 
72 #define KE_FILLER ('X')
73 
74 // translation of three byte code "K_SPECIAL a b" into int "K_xxx" and back
75 
76 #define TERMCAP2KEY(a, b) (-((a) + ((int)(b) << 8)))
77 #define KEY2TERMCAP0(x) ((-(x)) & 0xff)
78 #define KEY2TERMCAP1(x) (((unsigned)(-(x)) >> 8) & 0xff)
79 
80 // get second or third byte when translating special key code into three bytes
81 
82 #define K_SECOND(c) ((c) == K_SPECIAL ? KS_SPECIAL : (c) == \
83  NUL ? KS_ZERO : KEY2TERMCAP0(c))
84 
85 #define K_THIRD(c) (((c) == K_SPECIAL || (c) == \
86  NUL) ? KE_FILLER : KEY2TERMCAP1(c))
87 
89 #define TO_SPECIAL(a, b) ((a) == KS_SPECIAL ? K_SPECIAL : (a) == \
90  KS_ZERO ? K_ZERO : TERMCAP2KEY(a, b))
91 
92 // Codes for keys that do not have a termcap name.
93 // The numbers are fixed to make sure that recorded key sequences remain valid.
94 // Add new entries at the end, not halfway.
95 //
96 // K_SPECIAL KS_EXTRA KE_xxx
97 //
98 // Entries must be in the range 0x02-0x7f (see comment at K_SPECIAL).
99 enum key_extra {
100  KE_S_UP = 4, // shift-up
101  KE_S_DOWN = 5, // shift-down
102 
103  KE_S_F1 = 6, // shifted function keys
104  KE_S_F2 = 7,
105  KE_S_F3 = 8,
106  KE_S_F4 = 9,
107  KE_S_F5 = 10,
108  KE_S_F6 = 11,
109  KE_S_F7 = 12,
110  KE_S_F8 = 13,
111  KE_S_F9 = 14,
112  KE_S_F10 = 15,
113 
114  KE_S_F11 = 16,
115  KE_S_F12 = 17,
116  KE_S_F13 = 18,
117  KE_S_F14 = 19,
118  KE_S_F15 = 20,
119  KE_S_F16 = 21,
120  KE_S_F17 = 22,
121  KE_S_F18 = 23,
122  KE_S_F19 = 24,
123  KE_S_F20 = 25,
124 
125  KE_S_F21 = 26,
126  KE_S_F22 = 27,
127  KE_S_F23 = 28,
128  KE_S_F24 = 29,
129  KE_S_F25 = 30,
130  KE_S_F26 = 31,
131  KE_S_F27 = 32,
132  KE_S_F28 = 33,
133  KE_S_F29 = 34,
134  KE_S_F30 = 35,
135 
136  KE_S_F31 = 36,
137  KE_S_F32 = 37,
138  KE_S_F33 = 38,
139  KE_S_F34 = 39,
140  KE_S_F35 = 40,
141  KE_S_F36 = 41,
142  KE_S_F37 = 42,
143 
144  KE_MOUSE = 43, // mouse event start
145 
146  // Symbols for pseudo keys which are translated from the real key symbols
147  // above.
148  KE_LEFTMOUSE = 44, // Left mouse button click
149  KE_LEFTDRAG = 45, // Drag with left mouse button down
150  KE_LEFTRELEASE = 46, // Left mouse button release
151  KE_MIDDLEMOUSE = 47, // Middle mouse button click
152  KE_MIDDLEDRAG = 48, // Drag with middle mouse button down
153  KE_MIDDLERELEASE = 49, // Middle mouse button release
154  KE_RIGHTMOUSE = 50, // Right mouse button click
155  KE_RIGHTDRAG = 51, // Drag with right mouse button down
156  KE_RIGHTRELEASE = 52, // Right mouse button release
157 
158  KE_IGNORE = 53, // Ignored mouse drag/release
159 
160  KE_TAB = 54, // unshifted TAB key
161  KE_S_TAB_OLD = 55, // shifted TAB key (no longer used)
162 
163  // , KE_SNIFF_UNUSED = 56 // obsolete
164  KE_XF1 = 57, // extra vt100 function keys for xterm
165  KE_XF2 = 58,
166  KE_XF3 = 59,
167  KE_XF4 = 60,
168  KE_XEND = 61, // extra (vt100) end key for xterm
169  KE_ZEND = 62, // extra (vt100) end key for xterm
170  KE_XHOME = 63, // extra (vt100) home key for xterm
171  KE_ZHOME = 64, // extra (vt100) home key for xterm
172  KE_XUP = 65, // extra vt100 cursor keys for xterm
173  KE_XDOWN = 66,
174  KE_XLEFT = 67,
175  KE_XRIGHT = 68,
176 
177  KE_LEFTMOUSE_NM = 69, // non-mappable Left mouse button click
178  KE_LEFTRELEASE_NM = 70, // non-mappable left mouse button release
179 
180  KE_S_XF1 = 71, // vt100 shifted function keys for xterm
181  KE_S_XF2 = 72,
182  KE_S_XF3 = 73,
183  KE_S_XF4 = 74,
184 
185  // NOTE: The scroll wheel events are inverted: i.e. UP is the same as
186  // moving the actual scroll wheel down, LEFT is the same as moving the
187  // scroll wheel right.
188  KE_MOUSEDOWN = 75, // scroll wheel pseudo-button Down
189  KE_MOUSEUP = 76, // scroll wheel pseudo-button Up
190  KE_MOUSELEFT = 77, // scroll wheel pseudo-button Left
191  KE_MOUSERIGHT = 78, // scroll wheel pseudo-button Right
192 
193  KE_KINS = 79, // keypad Insert key
194  KE_KDEL = 80, // keypad Delete key
195 
196  // KE_CSI = 81, // Nvim doesn't need escaping CSI
197  KE_SNR = 82, // <SNR>
198  KE_PLUG = 83, // <Plug>
199  KE_CMDWIN = 84, // open command-line window from Command-line Mode
200 
201  KE_C_LEFT = 85, // control-left
202  KE_C_RIGHT = 86, // control-right
203  KE_C_HOME = 87, // control-home
204  KE_C_END = 88, // control-end
205 
206  KE_X1MOUSE = 89, // X1/X2 mouse-buttons
207  KE_X1DRAG = 90,
210  KE_X2DRAG = 93,
212 
213  KE_DROP = 95, // DnD data is available
214  // , KE_CURSORHOLD = 96 // CursorHold event
215  KE_NOP = 97, // no-op: does nothing
216  // , KE_FOCUSGAINED = 98 // focus gained
217  // , KE_FOCUSLOST = 99 // focus lost
218  KE_MOUSEMOVE = 100, // mouse moved with no button down
219  // , KE_CANCEL = 101 // return from vgetc
220  KE_EVENT = 102, // event
221  KE_LUA = 103, // lua special key
222  KE_COMMAND = 104, // <Cmd> special key
223 };
224 
225 // the three byte codes are replaced with the following int when using vgetc()
226 
227 #define K_ZERO TERMCAP2KEY(KS_ZERO, KE_FILLER)
228 
229 #define K_UP TERMCAP2KEY('k', 'u')
230 #define K_KUP TERMCAP2KEY('K', 'u') // keypad up
231 #define K_DOWN TERMCAP2KEY('k', 'd')
232 #define K_KDOWN TERMCAP2KEY('K', 'd') // keypad down
233 #define K_LEFT TERMCAP2KEY('k', 'l')
234 #define K_KLEFT TERMCAP2KEY('K', 'l') // keypad left
235 #define K_RIGHT TERMCAP2KEY('k', 'r')
236 #define K_KRIGHT TERMCAP2KEY('K', 'r') // keypad right
237 #define K_S_UP TERMCAP2KEY(KS_EXTRA, KE_S_UP)
238 #define K_S_DOWN TERMCAP2KEY(KS_EXTRA, KE_S_DOWN)
239 #define K_S_LEFT TERMCAP2KEY('#', '4')
240 #define K_C_LEFT TERMCAP2KEY(KS_EXTRA, KE_C_LEFT)
241 #define K_S_RIGHT TERMCAP2KEY('%', 'i')
242 #define K_C_RIGHT TERMCAP2KEY(KS_EXTRA, KE_C_RIGHT)
243 #define K_S_HOME TERMCAP2KEY('#', '2')
244 #define K_C_HOME TERMCAP2KEY(KS_EXTRA, KE_C_HOME)
245 #define K_S_END TERMCAP2KEY('*', '7')
246 #define K_C_END TERMCAP2KEY(KS_EXTRA, KE_C_END)
247 #define K_TAB TERMCAP2KEY(KS_EXTRA, KE_TAB)
248 #define K_S_TAB TERMCAP2KEY('k', 'B')
249 
250 // extra set of function keys F1-F4, for vt100 compatible xterm
251 #define K_XF1 TERMCAP2KEY(KS_EXTRA, KE_XF1)
252 #define K_XF2 TERMCAP2KEY(KS_EXTRA, KE_XF2)
253 #define K_XF3 TERMCAP2KEY(KS_EXTRA, KE_XF3)
254 #define K_XF4 TERMCAP2KEY(KS_EXTRA, KE_XF4)
255 
256 // extra set of cursor keys for vt100 compatible xterm
257 #define K_XUP TERMCAP2KEY(KS_EXTRA, KE_XUP)
258 #define K_XDOWN TERMCAP2KEY(KS_EXTRA, KE_XDOWN)
259 #define K_XLEFT TERMCAP2KEY(KS_EXTRA, KE_XLEFT)
260 #define K_XRIGHT TERMCAP2KEY(KS_EXTRA, KE_XRIGHT)
261 
262 #define K_F1 TERMCAP2KEY('k', '1') // function keys
263 #define K_F2 TERMCAP2KEY('k', '2')
264 #define K_F3 TERMCAP2KEY('k', '3')
265 #define K_F4 TERMCAP2KEY('k', '4')
266 #define K_F5 TERMCAP2KEY('k', '5')
267 #define K_F6 TERMCAP2KEY('k', '6')
268 #define K_F7 TERMCAP2KEY('k', '7')
269 #define K_F8 TERMCAP2KEY('k', '8')
270 #define K_F9 TERMCAP2KEY('k', '9')
271 #define K_F10 TERMCAP2KEY('k', ';')
272 
273 #define K_F11 TERMCAP2KEY('F', '1')
274 #define K_F12 TERMCAP2KEY('F', '2')
275 #define K_F13 TERMCAP2KEY('F', '3')
276 #define K_F14 TERMCAP2KEY('F', '4')
277 #define K_F15 TERMCAP2KEY('F', '5')
278 #define K_F16 TERMCAP2KEY('F', '6')
279 #define K_F17 TERMCAP2KEY('F', '7')
280 #define K_F18 TERMCAP2KEY('F', '8')
281 #define K_F19 TERMCAP2KEY('F', '9')
282 #define K_F20 TERMCAP2KEY('F', 'A')
283 
284 #define K_F21 TERMCAP2KEY('F', 'B')
285 #define K_F22 TERMCAP2KEY('F', 'C')
286 #define K_F23 TERMCAP2KEY('F', 'D')
287 #define K_F24 TERMCAP2KEY('F', 'E')
288 #define K_F25 TERMCAP2KEY('F', 'F')
289 #define K_F26 TERMCAP2KEY('F', 'G')
290 #define K_F27 TERMCAP2KEY('F', 'H')
291 #define K_F28 TERMCAP2KEY('F', 'I')
292 #define K_F29 TERMCAP2KEY('F', 'J')
293 #define K_F30 TERMCAP2KEY('F', 'K')
294 
295 #define K_F31 TERMCAP2KEY('F', 'L')
296 #define K_F32 TERMCAP2KEY('F', 'M')
297 #define K_F33 TERMCAP2KEY('F', 'N')
298 #define K_F34 TERMCAP2KEY('F', 'O')
299 #define K_F35 TERMCAP2KEY('F', 'P')
300 #define K_F36 TERMCAP2KEY('F', 'Q')
301 #define K_F37 TERMCAP2KEY('F', 'R')
302 #define K_F38 TERMCAP2KEY('F', 'S')
303 #define K_F39 TERMCAP2KEY('F', 'T')
304 #define K_F40 TERMCAP2KEY('F', 'U')
305 
306 #define K_F41 TERMCAP2KEY('F', 'V')
307 #define K_F42 TERMCAP2KEY('F', 'W')
308 #define K_F43 TERMCAP2KEY('F', 'X')
309 #define K_F44 TERMCAP2KEY('F', 'Y')
310 #define K_F45 TERMCAP2KEY('F', 'Z')
311 #define K_F46 TERMCAP2KEY('F', 'a')
312 #define K_F47 TERMCAP2KEY('F', 'b')
313 #define K_F48 TERMCAP2KEY('F', 'c')
314 #define K_F49 TERMCAP2KEY('F', 'd')
315 #define K_F50 TERMCAP2KEY('F', 'e')
316 
317 #define K_F51 TERMCAP2KEY('F', 'f')
318 #define K_F52 TERMCAP2KEY('F', 'g')
319 #define K_F53 TERMCAP2KEY('F', 'h')
320 #define K_F54 TERMCAP2KEY('F', 'i')
321 #define K_F55 TERMCAP2KEY('F', 'j')
322 #define K_F56 TERMCAP2KEY('F', 'k')
323 #define K_F57 TERMCAP2KEY('F', 'l')
324 #define K_F58 TERMCAP2KEY('F', 'm')
325 #define K_F59 TERMCAP2KEY('F', 'n')
326 #define K_F60 TERMCAP2KEY('F', 'o')
327 
328 #define K_F61 TERMCAP2KEY('F', 'p')
329 #define K_F62 TERMCAP2KEY('F', 'q')
330 #define K_F63 TERMCAP2KEY('F', 'r')
331 
332 // extra set of shifted function keys F1-F4, for vt100 compatible xterm
333 #define K_S_XF1 TERMCAP2KEY(KS_EXTRA, KE_S_XF1)
334 #define K_S_XF2 TERMCAP2KEY(KS_EXTRA, KE_S_XF2)
335 #define K_S_XF3 TERMCAP2KEY(KS_EXTRA, KE_S_XF3)
336 #define K_S_XF4 TERMCAP2KEY(KS_EXTRA, KE_S_XF4)
337 
338 #define K_S_F1 TERMCAP2KEY(KS_EXTRA, KE_S_F1) // shifted func. keys
339 #define K_S_F2 TERMCAP2KEY(KS_EXTRA, KE_S_F2)
340 #define K_S_F3 TERMCAP2KEY(KS_EXTRA, KE_S_F3)
341 #define K_S_F4 TERMCAP2KEY(KS_EXTRA, KE_S_F4)
342 #define K_S_F5 TERMCAP2KEY(KS_EXTRA, KE_S_F5)
343 #define K_S_F6 TERMCAP2KEY(KS_EXTRA, KE_S_F6)
344 #define K_S_F7 TERMCAP2KEY(KS_EXTRA, KE_S_F7)
345 #define K_S_F8 TERMCAP2KEY(KS_EXTRA, KE_S_F8)
346 #define K_S_F9 TERMCAP2KEY(KS_EXTRA, KE_S_F9)
347 #define K_S_F10 TERMCAP2KEY(KS_EXTRA, KE_S_F10)
348 
349 #define K_S_F11 TERMCAP2KEY(KS_EXTRA, KE_S_F11)
350 #define K_S_F12 TERMCAP2KEY(KS_EXTRA, KE_S_F12)
351 // K_S_F13 to K_S_F37 are currently not used
352 
353 #define K_HELP TERMCAP2KEY('%', '1')
354 #define K_UNDO TERMCAP2KEY('&', '8')
355 
356 #define K_BS TERMCAP2KEY('k', 'b')
357 
358 #define K_INS TERMCAP2KEY('k', 'I')
359 #define K_KINS TERMCAP2KEY(KS_EXTRA, KE_KINS)
360 #define K_DEL TERMCAP2KEY('k', 'D')
361 #define K_KDEL TERMCAP2KEY(KS_EXTRA, KE_KDEL)
362 #define K_HOME TERMCAP2KEY('k', 'h')
363 #define K_KHOME TERMCAP2KEY('K', '1') // keypad home (upper left)
364 #define K_XHOME TERMCAP2KEY(KS_EXTRA, KE_XHOME)
365 #define K_ZHOME TERMCAP2KEY(KS_EXTRA, KE_ZHOME)
366 #define K_END TERMCAP2KEY('@', '7')
367 #define K_KEND TERMCAP2KEY('K', '4') // keypad end (lower left)
368 #define K_XEND TERMCAP2KEY(KS_EXTRA, KE_XEND)
369 #define K_ZEND TERMCAP2KEY(KS_EXTRA, KE_ZEND)
370 #define K_PAGEUP TERMCAP2KEY('k', 'P')
371 #define K_PAGEDOWN TERMCAP2KEY('k', 'N')
372 #define K_KPAGEUP TERMCAP2KEY('K', '3') // keypad pageup (upper R.)
373 #define K_KPAGEDOWN TERMCAP2KEY('K', '5') // keypad pagedown (lower R.)
374 #define K_KORIGIN TERMCAP2KEY('K', '2') // keypad center
375 
376 #define K_KPLUS TERMCAP2KEY('K', '6') // keypad plus
377 #define K_KMINUS TERMCAP2KEY('K', '7') // keypad minus
378 #define K_KDIVIDE TERMCAP2KEY('K', '8') // keypad /
379 #define K_KMULTIPLY TERMCAP2KEY('K', '9') // keypad *
380 #define K_KENTER TERMCAP2KEY('K', 'A') // keypad Enter
381 #define K_KPOINT TERMCAP2KEY('K', 'B') // keypad . or ,
382 
383 #define K_K0 TERMCAP2KEY('K', 'C') // keypad 0
384 #define K_K1 TERMCAP2KEY('K', 'D') // keypad 1
385 #define K_K2 TERMCAP2KEY('K', 'E') // keypad 2
386 #define K_K3 TERMCAP2KEY('K', 'F') // keypad 3
387 #define K_K4 TERMCAP2KEY('K', 'G') // keypad 4
388 #define K_K5 TERMCAP2KEY('K', 'H') // keypad 5
389 #define K_K6 TERMCAP2KEY('K', 'I') // keypad 6
390 #define K_K7 TERMCAP2KEY('K', 'J') // keypad 7
391 #define K_K8 TERMCAP2KEY('K', 'K') // keypad 8
392 #define K_K9 TERMCAP2KEY('K', 'L') // keypad 9
393 
394 #define K_KCOMMA TERMCAP2KEY('K', 'M') // keypad comma
395 #define K_KEQUAL TERMCAP2KEY('K', 'N') // keypad equal
396 
397 #define K_MOUSE TERMCAP2KEY(KS_MOUSE, KE_FILLER)
398 #define K_MENU TERMCAP2KEY(KS_MENU, KE_FILLER)
399 #define K_VER_SCROLLBAR TERMCAP2KEY(KS_VER_SCROLLBAR, KE_FILLER)
400 #define K_HOR_SCROLLBAR TERMCAP2KEY(KS_HOR_SCROLLBAR, KE_FILLER)
401 
402 #define K_SELECT TERMCAP2KEY(KS_SELECT, KE_FILLER)
403 
404 #define K_TABLINE TERMCAP2KEY(KS_TABLINE, KE_FILLER)
405 #define K_TABMENU TERMCAP2KEY(KS_TABMENU, KE_FILLER)
406 
407 // Symbols for pseudo keys which are translated from the real key symbols
408 // above.
409 
410 #define K_LEFTMOUSE TERMCAP2KEY(KS_EXTRA, KE_LEFTMOUSE)
411 #define K_LEFTMOUSE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTMOUSE_NM)
412 #define K_LEFTDRAG TERMCAP2KEY(KS_EXTRA, KE_LEFTDRAG)
413 #define K_LEFTRELEASE TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE)
414 #define K_LEFTRELEASE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE_NM)
415 #define K_MOUSEMOVE TERMCAP2KEY(KS_EXTRA, KE_MOUSEMOVE)
416 #define K_MIDDLEMOUSE TERMCAP2KEY(KS_EXTRA, KE_MIDDLEMOUSE)
417 #define K_MIDDLEDRAG TERMCAP2KEY(KS_EXTRA, KE_MIDDLEDRAG)
418 #define K_MIDDLERELEASE TERMCAP2KEY(KS_EXTRA, KE_MIDDLERELEASE)
419 #define K_RIGHTMOUSE TERMCAP2KEY(KS_EXTRA, KE_RIGHTMOUSE)
420 #define K_RIGHTDRAG TERMCAP2KEY(KS_EXTRA, KE_RIGHTDRAG)
421 #define K_RIGHTRELEASE TERMCAP2KEY(KS_EXTRA, KE_RIGHTRELEASE)
422 #define K_X1MOUSE TERMCAP2KEY(KS_EXTRA, KE_X1MOUSE)
423 #define K_X1MOUSE TERMCAP2KEY(KS_EXTRA, KE_X1MOUSE)
424 #define K_X1DRAG TERMCAP2KEY(KS_EXTRA, KE_X1DRAG)
425 #define K_X1RELEASE TERMCAP2KEY(KS_EXTRA, KE_X1RELEASE)
426 #define K_X2MOUSE TERMCAP2KEY(KS_EXTRA, KE_X2MOUSE)
427 #define K_X2DRAG TERMCAP2KEY(KS_EXTRA, KE_X2DRAG)
428 #define K_X2RELEASE TERMCAP2KEY(KS_EXTRA, KE_X2RELEASE)
429 
430 #define K_IGNORE TERMCAP2KEY(KS_EXTRA, KE_IGNORE)
431 #define K_NOP TERMCAP2KEY(KS_EXTRA, KE_NOP)
432 
433 #define K_MOUSEDOWN TERMCAP2KEY(KS_EXTRA, KE_MOUSEDOWN)
434 #define K_MOUSEUP TERMCAP2KEY(KS_EXTRA, KE_MOUSEUP)
435 #define K_MOUSELEFT TERMCAP2KEY(KS_EXTRA, KE_MOUSELEFT)
436 #define K_MOUSERIGHT TERMCAP2KEY(KS_EXTRA, KE_MOUSERIGHT)
437 
438 #define K_SNR TERMCAP2KEY(KS_EXTRA, KE_SNR)
439 #define K_PLUG TERMCAP2KEY(KS_EXTRA, KE_PLUG)
440 #define K_CMDWIN TERMCAP2KEY(KS_EXTRA, KE_CMDWIN)
441 
442 #define K_DROP TERMCAP2KEY(KS_EXTRA, KE_DROP)
443 
444 #define K_EVENT TERMCAP2KEY(KS_EXTRA, KE_EVENT)
445 #define K_COMMAND TERMCAP2KEY(KS_EXTRA, KE_COMMAND)
446 #define K_LUA TERMCAP2KEY(KS_EXTRA, KE_LUA)
447 
448 // Bits for modifier mask
449 // 0x01 cannot be used, because the modifier must be 0x02 or higher
450 #define MOD_MASK_SHIFT 0x02
451 #define MOD_MASK_CTRL 0x04
452 #define MOD_MASK_ALT 0x08 // aka META
453 #define MOD_MASK_META 0x10 // META when it's different from ALT
454 #define MOD_MASK_2CLICK 0x20 // use MOD_MASK_MULTI_CLICK
455 #define MOD_MASK_3CLICK 0x40 // use MOD_MASK_MULTI_CLICK
456 #define MOD_MASK_4CLICK 0x60 // use MOD_MASK_MULTI_CLICK
457 #define MOD_MASK_CMD 0x80 // "super" key (macOS: command-key)
458 
459 #define MOD_MASK_MULTI_CLICK (MOD_MASK_2CLICK|MOD_MASK_3CLICK| \
460  MOD_MASK_4CLICK)
461 
464 #define MAX_KEY_NAME_LEN 32
465 
466 // Maximum length of a special key event as tokens. This includes modifiers.
467 // The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
468 // following string of tokens:
469 //
470 // <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KE_LEFTDRAG>.
471 //
472 // This is a total of 6 tokens, and is currently the longest one possible.
473 #define MAX_KEY_CODE_LEN 6
474 
475 #define FLAG_CPO_BSLASH 0x01
476 #define CPO_TO_CPO_FLAGS ((vim_strchr((char *)p_cpo, CPO_BSLASH) == NULL) \
477  ? 0 \
478  : FLAG_CPO_BSLASH)
479 
480 // Flags for replace_termcodes()
481 enum {
486 };
487 
488 // Flags for find_special_key()
489 enum {
490  FSK_KEYCODE = 0x01,
491  FSK_KEEP_X_KEY = 0x02,
492  FSK_IN_STRING = 0x04,
493  FSK_SIMPLIFY = 0x08,
494 };
495 
496 #ifdef INCLUDE_GENERATED_DECLARATIONS
497 # include "keycodes.h.generated.h"
498 #endif
499 #endif // NVIM_KEYCODES_H
KE_RIGHTMOUSE
@ KE_RIGHTMOUSE
Definition: keycodes.h:154
KE_S_F36
@ KE_S_F36
Definition: keycodes.h:141
KE_S_F35
@ KE_S_F35
Definition: keycodes.h:140
KE_S_F21
@ KE_S_F21
Definition: keycodes.h:125
KE_S_F15
@ KE_S_F15
Definition: keycodes.h:118
REPTERM_NO_SIMPLIFY
@ REPTERM_NO_SIMPLIFY
Definition: keycodes.h:485
KE_XRIGHT
@ KE_XRIGHT
Definition: keycodes.h:175
KE_LEFTDRAG
@ KE_LEFTDRAG
Definition: keycodes.h:149
key_extra
key_extra
Definition: keycodes.h:99
KE_XF4
@ KE_XF4
Definition: keycodes.h:167
KE_S_F26
@ KE_S_F26
Definition: keycodes.h:130
KE_S_F27
@ KE_S_F27
Definition: keycodes.h:131
KE_LEFTRELEASE
@ KE_LEFTRELEASE
Definition: keycodes.h:150
KE_XLEFT
@ KE_XLEFT
Definition: keycodes.h:174
KE_S_F8
@ KE_S_F8
Definition: keycodes.h:110
KE_XF2
@ KE_XF2
Definition: keycodes.h:165
REPTERM_FROM_PART
@ REPTERM_FROM_PART
Definition: keycodes.h:482
KE_S_F13
@ KE_S_F13
Definition: keycodes.h:116
KE_S_F2
@ KE_S_F2
Definition: keycodes.h:104
KE_S_F34
@ KE_S_F34
Definition: keycodes.h:139
KE_LEFTMOUSE
@ KE_LEFTMOUSE
Definition: keycodes.h:148
KE_C_HOME
@ KE_C_HOME
Definition: keycodes.h:203
KE_S_F9
@ KE_S_F9
Definition: keycodes.h:111
KE_X1DRAG
@ KE_X1DRAG
Definition: keycodes.h:207
KE_S_F1
@ KE_S_F1
Definition: keycodes.h:103
KE_NOP
@ KE_NOP
Definition: keycodes.h:215
KE_S_F16
@ KE_S_F16
Definition: keycodes.h:119
KE_S_F17
@ KE_S_F17
Definition: keycodes.h:120
KE_S_F22
@ KE_S_F22
Definition: keycodes.h:126
FSK_SIMPLIFY
@ FSK_SIMPLIFY
simplify <C-H>, etc.
Definition: keycodes.h:493
KE_RIGHTDRAG
@ KE_RIGHTDRAG
Definition: keycodes.h:155
FSK_IN_STRING
@ FSK_IN_STRING
in string, double quote is escaped
Definition: keycodes.h:492
KE_MIDDLEDRAG
@ KE_MIDDLEDRAG
Definition: keycodes.h:152
KE_MOUSEMOVE
@ KE_MOUSEMOVE
Definition: keycodes.h:218
KE_S_DOWN
@ KE_S_DOWN
Definition: keycodes.h:101
FSK_KEYCODE
@ FSK_KEYCODE
prefer key code, e.g. K_DEL in place of DEL
Definition: keycodes.h:490
KE_MOUSE
@ KE_MOUSE
Definition: keycodes.h:144
KE_S_F32
@ KE_S_F32
Definition: keycodes.h:137
KE_S_XF4
@ KE_S_XF4
Definition: keycodes.h:183
KE_KDEL
@ KE_KDEL
Definition: keycodes.h:194
KE_S_F29
@ KE_S_F29
Definition: keycodes.h:133
KE_LEFTMOUSE_NM
@ KE_LEFTMOUSE_NM
Definition: keycodes.h:177
KE_X2RELEASE
@ KE_X2RELEASE
Definition: keycodes.h:211
KE_SNR
@ KE_SNR
Definition: keycodes.h:197
KE_TAB
@ KE_TAB
Definition: keycodes.h:160
KE_RIGHTRELEASE
@ KE_RIGHTRELEASE
Definition: keycodes.h:156
KE_ZHOME
@ KE_ZHOME
Definition: keycodes.h:171
KE_S_TAB_OLD
@ KE_S_TAB_OLD
Definition: keycodes.h:161
KE_KINS
@ KE_KINS
Definition: keycodes.h:193
KE_MIDDLERELEASE
@ KE_MIDDLERELEASE
Definition: keycodes.h:153
KE_S_XF1
@ KE_S_XF1
Definition: keycodes.h:180
KE_S_F3
@ KE_S_F3
Definition: keycodes.h:105
REPTERM_NO_SPECIAL
@ REPTERM_NO_SPECIAL
Definition: keycodes.h:484
KE_S_F4
@ KE_S_F4
Definition: keycodes.h:106
KE_S_F10
@ KE_S_F10
Definition: keycodes.h:112
KE_X2DRAG
@ KE_X2DRAG
Definition: keycodes.h:210
KE_S_F37
@ KE_S_F37
Definition: keycodes.h:142
KE_S_F28
@ KE_S_F28
Definition: keycodes.h:132
KE_MOUSELEFT
@ KE_MOUSELEFT
Definition: keycodes.h:190
KE_X1MOUSE
@ KE_X1MOUSE
Definition: keycodes.h:206
KE_S_F24
@ KE_S_F24
Definition: keycodes.h:128
KE_C_LEFT
@ KE_C_LEFT
Definition: keycodes.h:201
REPTERM_DO_LT
@ REPTERM_DO_LT
Definition: keycodes.h:483
KE_S_F23
@ KE_S_F23
Definition: keycodes.h:127
strings.h
KE_LUA
@ KE_LUA
Definition: keycodes.h:221
KE_LEFTRELEASE_NM
@ KE_LEFTRELEASE_NM
Definition: keycodes.h:178
KE_S_F33
@ KE_S_F33
Definition: keycodes.h:138
KE_S_XF3
@ KE_S_XF3
Definition: keycodes.h:182
KE_S_F31
@ KE_S_F31
Definition: keycodes.h:136
KE_ZEND
@ KE_ZEND
Definition: keycodes.h:169
KE_COMMAND
@ KE_COMMAND
Definition: keycodes.h:222
KE_EVENT
@ KE_EVENT
Definition: keycodes.h:220
KE_S_F6
@ KE_S_F6
Definition: keycodes.h:108
KE_S_XF2
@ KE_S_XF2
Definition: keycodes.h:181
KE_S_F7
@ KE_S_F7
Definition: keycodes.h:109
KE_XF3
@ KE_XF3
Definition: keycodes.h:166
KE_S_F11
@ KE_S_F11
Definition: keycodes.h:114
KE_MOUSEDOWN
@ KE_MOUSEDOWN
Definition: keycodes.h:188
KE_DROP
@ KE_DROP
Definition: keycodes.h:213
KE_S_F30
@ KE_S_F30
Definition: keycodes.h:134
KE_XUP
@ KE_XUP
Definition: keycodes.h:172
KE_S_F25
@ KE_S_F25
Definition: keycodes.h:129
FSK_KEEP_X_KEY
@ FSK_KEEP_X_KEY
don’t translate xHome to Home key
Definition: keycodes.h:491
KE_X1RELEASE
@ KE_X1RELEASE
Definition: keycodes.h:208
KE_X2MOUSE
@ KE_X2MOUSE
Definition: keycodes.h:209
KE_XHOME
@ KE_XHOME
Definition: keycodes.h:170
KE_C_END
@ KE_C_END
Definition: keycodes.h:204
KE_S_F14
@ KE_S_F14
Definition: keycodes.h:117
KE_S_F19
@ KE_S_F19
Definition: keycodes.h:122
KE_S_F20
@ KE_S_F20
Definition: keycodes.h:123
KE_XDOWN
@ KE_XDOWN
Definition: keycodes.h:173
KE_IGNORE
@ KE_IGNORE
Definition: keycodes.h:158
KE_S_UP
@ KE_S_UP
Definition: keycodes.h:100
KE_PLUG
@ KE_PLUG
Definition: keycodes.h:198
KE_CMDWIN
@ KE_CMDWIN
Definition: keycodes.h:199
KE_XEND
@ KE_XEND
Definition: keycodes.h:168
KE_S_F5
@ KE_S_F5
Definition: keycodes.h:107
KE_S_F18
@ KE_S_F18
Definition: keycodes.h:121
KE_C_RIGHT
@ KE_C_RIGHT
Definition: keycodes.h:202
KE_XF1
@ KE_XF1
Definition: keycodes.h:164
KE_MOUSERIGHT
@ KE_MOUSERIGHT
Definition: keycodes.h:191
KE_S_F12
@ KE_S_F12
Definition: keycodes.h:115
KE_MOUSEUP
@ KE_MOUSEUP
Definition: keycodes.h:189
KE_MIDDLEMOUSE
@ KE_MIDDLEMOUSE
Definition: keycodes.h:151