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