blob: 407b45f835bc3e8c4aa1cb7b4090bd842d10e1d6 [file] [log] [blame]
Bram Moolenaaredf3f972016-08-29 22:49:24 +02001/* vi:set ts=8 sts=4 sw=4 noet:
Bram Moolenaar071d4272004-06-13 20:20:40 +00002 *
3 * VIM - Vi IMproved by Bram Moolenaar
4 *
5 * Do ":help uganda" in Vim to read copying and usage conditions.
6 * Do ":help credits" in Vim to see a list of people who contributed.
7 * See README.txt for an overview of the Vim source code.
8 */
9
10/*
11 * digraph.c: code for digraphs
12 */
13
14#include "vim.h"
15
16#if defined(FEAT_DIGRAPHS) || defined(PROTO)
17
18#ifdef FEAT_MBYTE
19typedef int result_T;
20#else
21typedef char_u result_T;
22#endif
23
24typedef struct digraph
25{
26 char_u char1;
27 char_u char2;
28 result_T result;
29} digr_T;
30
Bram Moolenaareae8ae12018-12-14 18:53:02 +010031static void printdigraph(digr_T *dp, result_T *previous);
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
33/* digraphs added by the user */
Bram Moolenaar0ab2a882009-05-13 10:51:08 +000034static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
36/*
37 * Note: Characters marked with XX are not included literally, because some
38 * compilers cannot handle them (Amiga SAS/C is the most picky one).
39 */
Bram Moolenaar6c0b44b2005-06-01 21:56:33 +000040static digr_T digraphdefault[] =
Bram Moolenaar48e330a2016-02-23 14:53:34 +010041#ifdef __MINT__
Bram Moolenaar071d4272004-06-13 20:20:40 +000042
43 /*
44 * ATARI digraphs
45 */
Bram Moolenaar071d4272004-06-13 20:20:40 +000046 {{'C', ',', 128}, /* ~@ XX */
47 {'u', '"', 129}, /*  */
48 {'e', '\'', 130}, /* ‚ */
49 {'a', '^', 131}, /* ƒ */
50 {'a', '"', 132}, /* „ */
51 {'a', '`', 133}, /* … */
52 {'a', '@', 134}, /* † */
53 {'c', ',', 135}, /* ~G XX */
54 {'e', '^', 136}, /* ~H XX */
55 {'e', '"', 137}, /* ‰ */
56 {'e', '`', 138}, /* Š */
57 {'i', '"', 139}, /* ‹ */
58 {'i', '^', 140}, /* Œ */
59 {'i', '`', 141}, /*  */
60 {'A', '"', 142}, /* Ž */
61 {'A', '@', 143}, /*  */
62 {'E', '\'', 144}, /*  */
63 {'a', 'e', 145}, /* ‘ */
64 {'A', 'E', 146}, /* ’ */
65 {'o', '^', 147}, /* “ */
66 {'o', '"', 148}, /* ” */
67 {'o', '`', 149}, /* • */
68 {'u', '^', 150}, /* – */
69 {'u', '`', 151}, /* — */
70 {'y', '"', 152}, /* ˜ */
71 {'O', '"', 153}, /* ™ */
72 {'U', '"', 154}, /* š */
73 {'c', '|', 155}, /* › */
74 {'$', '$', 156}, /* œ */
75 {'Y', '-', 157}, /* ~] XX */
76 {'s', 's', 158}, /* ž */
77 {'f', 'f', 159}, /* Ÿ */
78 {'a', '\'', 160}, /*   */
79 {'i', '\'', 161}, /* ¡ */
80 {'o', '\'', 162}, /* ¢ */
81 {'u', '\'', 163}, /* £ */
82 {'n', '~', 164}, /* ¤ */
83 {'N', '~', 165}, /* ¥ */
84 {'a', 'a', 166}, /* ¦ */
85 {'o', 'o', 167}, /* § */
86 {'~', '?', 168}, /* ¨ */
87 {'-', 'a', 169}, /* © */
88 {'a', '-', 170}, /* ª */
89 {'1', '2', 171}, /* « */
90 {'1', '4', 172}, /* ¬ */
91 {'~', '!', 173}, /* ­ */
92 {'<', '<', 174}, /* ® */
93 {'>', '>', 175}, /* ¯ */
94 {'j', 'u', 230}, /* æ */
95 {'o', '/', 237}, /* í */
96 {'+', '-', 241}, /* ñ */
97 {'>', '=', 242}, /* ò */
98 {'<', '=', 243}, /* ó */
99 {':', '-', 246}, /* ö */
100 {'~', '~', 247}, /* ÷ */
101 {'~', 'o', 248}, /* ø */
102 {'2', '2', 253}, /* ý */
103 {NUL, NUL, NUL}
104 };
105
Bram Moolenaar48e330a2016-02-23 14:53:34 +0100106#else /* !__MINT__ */
107# ifdef HPUX_DIGRAPHS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108
109 /*
110 * different HPUX digraphs
111 */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000112 {{'A', '`', 161}, /* ¡ */
113 {'A', '^', 162}, /* ¢ */
114 {'E', '`', 163}, /* £ */
115 {'E', '^', 164}, /* ¤ */
116 {'E', '"', 165}, /* ¥ */
117 {'I', '^', 166}, /* ¦ */
118 {'I', '"', 167}, /* § */
119 {'\'', '\'', 168}, /* ¨ */
120 {'`', '`', 169}, /* © */
121 {'^', '^', 170}, /* ª */
122 {'"', '"', 171}, /* « */
123 {'~', '~', 172}, /* ¬ */
124 {'U', '`', 173}, /* ­ */
125 {'U', '^', 174}, /* ® */
126 {'L', '=', 175}, /* ¯ */
127 {'~', '_', 176}, /* ° */
128 {'Y', '\'', 177}, /* ± */
129 {'y', '\'', 178}, /* ² */
130 {'~', 'o', 179}, /* ³ */
131 {'C', ',', 180}, /* ´ */
132 {'c', ',', 181}, /* µ */
133 {'N', '~', 182}, /* ¶ */
134 {'n', '~', 183}, /* · */
135 {'~', '!', 184}, /* ¸ */
136 {'~', '?', 185}, /* ¹ */
137 {'o', 'x', 186}, /* º */
138 {'L', '-', 187}, /* » */
139 {'Y', '=', 188}, /* ¼ */
140 {'p', 'p', 189}, /* ½ */
141 {'f', 'l', 190}, /* ¾ */
142 {'c', '|', 191}, /* ¿ */
143 {'a', '^', 192}, /* À */
144 {'e', '^', 193}, /* Á */
145 {'o', '^', 194}, /* Â */
146 {'u', '^', 195}, /* Ã */
147 {'a', '\'', 196}, /* Ä */
148 {'e', '\'', 197}, /* Å */
149 {'o', '\'', 198}, /* Æ */
150 {'u', '\'', 199}, /* Ç */
151 {'a', '`', 200}, /* È */
152 {'e', '`', 201}, /* É */
153 {'o', '`', 202}, /* Ê */
154 {'u', '`', 203}, /* Ë */
155 {'a', '"', 204}, /* Ì */
156 {'e', '"', 205}, /* Í */
157 {'o', '"', 206}, /* Î */
158 {'u', '"', 207}, /* Ï */
159 {'A', 'o', 208}, /* Ð */
160 {'i', '^', 209}, /* Ñ */
161 {'O', '/', 210}, /* Ò */
162 {'A', 'E', 211}, /* Ó */
163 {'a', 'o', 212}, /* Ô */
164 {'i', '\'', 213}, /* Õ */
165 {'o', '/', 214}, /* Ö */
166 {'a', 'e', 215}, /* × */
167 {'A', '"', 216}, /* Ø */
168 {'i', '`', 217}, /* Ù */
169 {'O', '"', 218}, /* Ú */
170 {'U', '"', 219}, /* Û */
171 {'E', '\'', 220}, /* Ü */
172 {'i', '"', 221}, /* Ý */
173 {'s', 's', 222}, /* Þ */
174 {'O', '^', 223}, /* ß */
175 {'A', '\'', 224}, /* à */
176 {'A', '~', 225}, /* á */
177 {'a', '~', 226}, /* â */
178 {'D', '-', 227}, /* ã */
179 {'d', '-', 228}, /* ä */
180 {'I', '\'', 229}, /* å */
181 {'I', '`', 230}, /* æ */
182 {'O', '\'', 231}, /* ç */
183 {'O', '`', 232}, /* è */
184 {'O', '~', 233}, /* é */
185 {'o', '~', 234}, /* ê */
186 {'S', '~', 235}, /* ë */
187 {'s', '~', 236}, /* ì */
188 {'U', '\'', 237}, /* í */
189 {'Y', '"', 238}, /* î */
190 {'y', '"', 239}, /* ï */
191 {'p', '-', 240}, /* ð */
192 {'p', '~', 241}, /* ñ */
193 {'~', '.', 242}, /* ò */
194 {'j', 'u', 243}, /* ó */
195 {'P', 'p', 244}, /* ô */
196 {'3', '4', 245}, /* õ */
197 {'-', '-', 246}, /* ö */
198 {'1', '4', 247}, /* ÷ */
199 {'1', '2', 248}, /* ø */
200 {'a', '_', 249}, /* ù */
201 {'o', '_', 250}, /* ú */
202 {'<', '<', 251}, /* û */
203 {'x', 'x', 252}, /* ü */
204 {'>', '>', 253}, /* ý */
205 {'+', '-', 254}, /* þ */
206 {'n', 'u', 255}, /* x XX */
207 {NUL, NUL, NUL}
208 };
209
Bram Moolenaar48e330a2016-02-23 14:53:34 +0100210# else /* !HPUX_DIGRAPHS */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211
Bram Moolenaar48e330a2016-02-23 14:53:34 +0100212# ifdef EBCDIC
Bram Moolenaar071d4272004-06-13 20:20:40 +0000213
214 /*
215 * EBCDIC - ISO digraphs
216 * TODO: EBCDIC Table is Code-Page 1047
217 */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000218 {{'a', '^', 66}, /* â */
219 {'a', '"', 67}, /* ä */
220 {'a', '`', 68}, /* à */
221 {'a', '\'', 69}, /* á */
222 {'a', '~', 70}, /* ã */
223 {'a', '@', 71}, /* å */
224 {'a', 'a', 71}, /* å */
225 {'c', ',', 72}, /* ç */
226 {'n', '~', 73}, /* ñ */
227 {'c', '|', 74}, /* ¢ */
228 {'e', '\'', 81}, /* é */
229 {'e', '^', 82}, /* ê */
230 {'e', '"', 83}, /* ë */
231 {'e', '`', 84}, /* è */
232 {'i', '\'', 85}, /* í */
233 {'i', '^', 86}, /* î */
234 {'i', '"', 87}, /* ï */
235 {'i', '`', 88}, /* ì */
236 {'s', 's', 89}, /* ß */
237 {'A', '^', 98}, /* Â */
238 {'A', '"', 99}, /* Ä */
239 {'A', '`', 100}, /* À */
240 {'A', '\'', 101}, /* Á */
241 {'A', '~', 102}, /* Ã */
242 {'A', '@', 103}, /* Å */
243 {'A', 'A', 103}, /* Å */
244 {'C', ',', 104}, /* Ç */
245 {'N', '~', 105}, /* Ñ */
246 {'|', '|', 106}, /* ¦ */
247 {'o', '/', 112}, /* ø */
248 {'E', '\'', 113}, /* É */
249 {'E', '^', 114}, /* Ê */
250 {'E', '"', 115}, /* Ë */
251 {'E', '`', 116}, /* È */
252 {'I', '\'', 117}, /* Í */
253 {'I', '^', 118}, /* Î */
254 {'I', '"', 119}, /* Ï */
255 {'I', '`', 120}, /* Ì */
256 {'O', '/', 128}, /* 0/ XX */
257 {'<', '<', 138}, /* « */
258 {'>', '>', 139}, /* » */
259 {'d', '-', 140}, /* ð */
260 {'y', '\'', 141}, /* ý */
261 {'i', 'p', 142}, /* þ */
262 {'+', '-', 143}, /* ± */
263 {'~', 'o', 144}, /* ° */
264 {'a', '-', 154}, /* ª */
265 {'o', '-', 155}, /* º */
266 {'a', 'e', 156}, /* æ */
267 {',', ',', 157}, /* , XX */
268 {'A', 'E', 158}, /* Æ */
269 {'o', 'x', 159}, /* ¤ - currency symbol in ISO 8859-1 */
270 {'e', '=', 159}, /* ¤ - euro symbol in ISO 8859-15 */
Bram Moolenaarf75a9632005-09-13 21:20:47 +0000271 {'E', 'u', 159}, /* ¤ - euro symbol in ISO 8859-15 */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000272 {'j', 'u', 160}, /* µ */
273 {'y', '"', 167}, /* x XX */
274 {'~', '!', 170}, /* ¡ */
275 {'~', '?', 171}, /* ¿ */
276 {'D', '-', 172}, /* Ð */
277 {'I', 'p', 174}, /* Þ */
278 {'r', 'O', 175}, /* ® */
279 {'-', ',', 176}, /* ¬ */
280 {'$', '$', 177}, /* £ */
281 {'Y', '-', 178}, /* ¥ */
282 {'~', '.', 179}, /* · */
283 {'c', 'O', 180}, /* © */
284 {'p', 'a', 181}, /* § */
285 {'p', 'p', 182}, /* ¶ */
286 {'1', '4', 183}, /* ¼ */
287 {'1', '2', 184}, /* ½ */
288 {'3', '4', 185}, /* ¾ */
289 {'Y', '\'', 186}, /* Ý */
290 {'"', '"', 187}, /* ¨ */
291 {'-', '=', 188}, /* ¯ */
292 {'\'', '\'', 190}, /* ´ */
293 {'O', 'E', 191}, /* × - OE in ISO 8859-15 */
294 {'/', '\\', 191}, /* × - multiplication symbol in ISO 8859-1 */
295 {'-', '-', 202}, /* ­ */
296 {'o', '^', 203}, /* ô */
297 {'o', '"', 204}, /* ö */
298 {'o', '`', 205}, /* ò */
299 {'o', '\'', 206}, /* ó */
300 {'o', '~', 207}, /* õ */
301 {'1', '1', 218}, /* ¹ */
302 {'u', '^', 219}, /* û */
303 {'u', '"', 220}, /* ü */
304 {'u', '`', 221}, /* ù */
305 {'u', '\'', 222}, /* ú */
306 {':', '-', 225}, /* ÷ - division symbol in ISO 8859-1 */
307 {'o', 'e', 225}, /* ÷ - oe in ISO 8859-15 */
308 {'2', '2', 234}, /* ² */
309 {'O', '^', 235}, /* Ô */
310 {'O', '"', 236}, /* Ö */
311 {'O', '`', 237}, /* Ò */
312 {'O', '\'', 238}, /* Ó */
313 {'O', '~', 239}, /* Õ */
314 {'3', '3', 250}, /* ³ */
315 {'U', '^', 251}, /* Û */
316 {'U', '"', 252}, /* Ü */
317 {'U', '`', 253}, /* Ù */
318 {'U', '\'', 254}, /* Ú */
319 {NUL, NUL, NUL}
320 };
321
Bram Moolenaar48e330a2016-02-23 14:53:34 +0100322# else
Bram Moolenaard0573012017-10-28 21:11:06 +0200323# if defined(MACOS_X) && !defined(FEAT_MBYTE)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000324
325 /*
326 * Macintosh digraphs
327 */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000328 {{'a', 't', 64}, /* @ */
329 {'A', '"', 128}, /* ~@ XX */
330 {'A', 'o', 129}, /* Å */
331 {'C', ',', 130}, /* Ç */
332 {'E', '\'', 131}, /* É */
333 {'N', '~', 132}, /* Ñ */
334 {'O', '"', 133}, /* Ö */
335 {'U', '"', 134}, /* Ü */
336 {'a', '\'', 135}, /* ~G XX */
337 {'a', '`', 136}, /* ~H XX */
338 {'a', '^', 137}, /* â */
339 {'a', '"', 138}, /* ä */
340 {'a', '~', 139}, /* ã */
341 {'a', 'o', 140}, /* å */
342 {'c', ',', 141}, /* ç */
343 {'e', '\'', 142}, /* é */
344 {'e', '`', 143}, /* è */
345 {'e', '^', 144}, /* ê */
346 {'e', '"', 145}, /* ë */
347 {'i', '\'', 146}, /* í */
348 {'i', '`', 147}, /* ì */
349 {'i', '^', 148}, /* î */
350 {'i', '"', 149}, /* ï */
351 {'n', '~', 150}, /* ñ */
352 {'o', '\'', 151}, /* ó */
353 {'o', '`', 152}, /* ò */
354 {'o', '^', 153}, /* ô */
355 {'o', '"', 154}, /* ö */
356 {'o', '~', 155}, /* o */
357 {'u', '\'', 156}, /* ú */
358 {'u', '`', 157}, /* ~] XX */
359 {'u', '^', 158}, /* û */
360 {'u', '"', 159}, /* ü */
361 {'+', '_', 160}, /* Ý */
362 {'~', 'o', 161}, /* ° */
363 {'c', '|', 162}, /* ¢ */
364 {'$', '$', 163}, /* £ */
365 {'p', 'a', 164}, /* § */
366 {'.', '.', 165}, /* * */
367 {'P', 'P', 166}, /* ¶ */
368 {'s', 's', 167}, /* ß */
369 {'r', 'O', 168}, /* ® */
370 {'c', 'O', 169}, /* © */
371 {'T', 'M', 170}, /*  */
372 {'=', '/', 173}, /* ‚ */
373 {'A', 'E', 174}, /* Æ */
374 {'O', '/', 175}, /* Ø */
375 {'0', '0', 176}, /* ƒ */
376 {'+', '-', 177}, /* ± */
377 {'<', '=', 178}, /* ¾ */
378 {'>', '=', 179}, /* „ */
379 {'Y', '-', 180}, /* ¥ */
380 {'j', 'u', 181}, /* µ */
381 {'m', 'u', 181}, /* µ */
382 {'d', 'd', 182}, /*  */
383 {'S', 'S', 183}, /* … */
384 {'S', 'I', 183}, /* … */
385 {'P', 'I', 184}, /* ½ */
386 {'p', 'i', 185}, /* ¼ */
387 {'I', 'I', 186}, /* † */
388 {'a', '-', 187}, /* » */
389 {'o', '-', 188}, /* º */
390 {'O', 'M', 189}, /* ½ */
391 {'a', 'e', 190}, /* æ */
392 {'o', '/', 191}, /* ø */
393 {'~', '?', 192}, /* ¿ */
394 {'~', '!', 193}, /* ¡ */
395 {'-', ',', 194}, /* ¬ */
396 {'v', '-', 195}, /* ~H XX */
397 {'f', '-', 196}, /* Ÿ */
398 {'~', '~', 197}, /* ‰ */
399 {'D', 'E', 198}, /*  */
400 {'<', '<', 199}, /* « */
401 {'>', '>', 200}, /* » */
402 {'.', ':', 201}, /* Š */
403 {'A', '`', 203}, /* À */
404 {'A', '~', 204}, /* Ã */
405 {'O', '~', 205}, /* Õ */
406 {'O', 'E', 206}, /* ‘ */
407 {'o', 'e', 207}, /* ¦ */
408 {'-', '.', 208}, /* - */
409 {'-', '-', 209}, /* - */
410 {'`', '`', 210}, /* " */
411 {'\'', '\'', 211}, /* " */
412 {'`', ' ', 212}, /* ' */
413 {'\'', ' ', 213}, /* ' */
414 {'-', ':', 214}, /* ÷ */
415 {'D', 'I', 215}, /* × */
Bram Moolenaar4221e5f2009-05-13 12:15:37 +0000416 {'y', ':', 216}, /* ÿ */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000417 {'Y', ':', 217}, /*  */
418 {'/', '/', 218}, /* Ž */
419 {'E', '=', 219}, /* ¤ Euro System >=8.5 */
420 {'o', 'x', 219}, /* ¤ Currency System <=8.1*/
421 {'<', ' ', 220}, /* Ð */
422 {'>', ' ', 221}, /* ð */
423 {'f', 'i', 222}, /* Þ */
424 {'f', 'l', 223}, /* þ */
425 {'+', '+', 224}, /* ý */
426 {'~', '.', 225}, /* · */
427 {',', ' ', 226}, /* ’ */
428 {',', ',', 227}, /* “ */
429 {'%', '.', 228}, /* ” */
430 {'%', '0', 228}, /* ” */
431 {'A', '^', 229}, /* Â */
432 {'E', '^', 230}, /* Ê */
433 {'A', '\'', 231}, /* Á */
434 {'E', '"', 232}, /* Ë */
435 {'E', '`', 233}, /* È */
436 {'I', '\'', 234}, /* Í */
437 {'I', '^', 235}, /* Î */
438 {'I', '"', 236}, /* Ï */
439 {'I', '`', 237}, /* Ì */
440 {'O', '\'', 238}, /* Ó */
441 {'O', '^', 239}, /* Ô */
442 {'A', 'P', 240}, /* • */
443 {'O', '`', 241}, /* Ò */
444 {'U', '\'', 242}, /* Ú */
445 {'U', '^', 243}, /* Û */
446 {'U', '`', 244}, /* Ù */
447 {'i', '.', 245}, /* ž */
448 {NUL, NUL, NUL}
449 };
450
Bram Moolenaard0573012017-10-28 21:11:06 +0200451# else /* !MACOS_X */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452
Bram Moolenaar48e330a2016-02-23 14:53:34 +0100453# ifdef OLD_DIGRAPHS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454
455 /*
456 * digraphs compatible with Vim 5.x
457 */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000458 {{'~', '!', 161}, /* ¡ */
459 {'c', '|', 162}, /* ¢ */
460 {'$', '$', 163}, /* £ */
461 {'o', 'x', 164}, /* ¤ - currency symbol in ISO 8859-1 */
462 {'e', '=', 164}, /* ¤ - euro symbol in ISO 8859-15 */
463 {'Y', '-', 165}, /* ¥ */
464 {'|', '|', 166}, /* ¦ */
465 {'p', 'a', 167}, /* § */
466 {'"', '"', 168}, /* ¨ */
467 {'c', 'O', 169}, /* © */
468 {'a', '-', 170}, /* ª */
469 {'<', '<', 171}, /* « */
470 {'-', ',', 172}, /* ¬ */
471 {'-', '-', 173}, /* ­ */
472 {'r', 'O', 174}, /* ® */
473 {'-', '=', 175}, /* ¯ */
474 {'~', 'o', 176}, /* ° */
475 {'+', '-', 177}, /* ± */
476 {'2', '2', 178}, /* ² */
477 {'3', '3', 179}, /* ³ */
478 {'\'', '\'', 180}, /* ´ */
479 {'j', 'u', 181}, /* µ */
480 {'p', 'p', 182}, /* ¶ */
481 {'~', '.', 183}, /* · */
482 {',', ',', 184}, /* ¸ */
483 {'1', '1', 185}, /* ¹ */
484 {'o', '-', 186}, /* º */
485 {'>', '>', 187}, /* » */
486 {'1', '4', 188}, /* ¼ */
487 {'1', '2', 189}, /* ½ */
488 {'3', '4', 190}, /* ¾ */
489 {'~', '?', 191}, /* ¿ */
490 {'A', '`', 192}, /* À */
491 {'A', '\'', 193}, /* Á */
492 {'A', '^', 194}, /* Â */
493 {'A', '~', 195}, /* Ã */
494 {'A', '"', 196}, /* Ä */
495 {'A', '@', 197}, /* Å */
496 {'A', 'A', 197}, /* Å */
497 {'A', 'E', 198}, /* Æ */
498 {'C', ',', 199}, /* Ç */
499 {'E', '`', 200}, /* È */
500 {'E', '\'', 201}, /* É */
501 {'E', '^', 202}, /* Ê */
502 {'E', '"', 203}, /* Ë */
503 {'I', '`', 204}, /* Ì */
504 {'I', '\'', 205}, /* Í */
505 {'I', '^', 206}, /* Î */
506 {'I', '"', 207}, /* Ï */
507 {'D', '-', 208}, /* Ð */
508 {'N', '~', 209}, /* Ñ */
509 {'O', '`', 210}, /* Ò */
510 {'O', '\'', 211}, /* Ó */
511 {'O', '^', 212}, /* Ô */
512 {'O', '~', 213}, /* Õ */
513 {'O', '"', 214}, /* Ö */
514 {'/', '\\', 215}, /* × - multiplication symbol in ISO 8859-1 */
515 {'O', 'E', 215}, /* × - OE in ISO 8859-15 */
516 {'O', '/', 216}, /* Ø */
517 {'U', '`', 217}, /* Ù */
518 {'U', '\'', 218}, /* Ú */
519 {'U', '^', 219}, /* Û */
520 {'U', '"', 220}, /* Ü */
521 {'Y', '\'', 221}, /* Ý */
522 {'I', 'p', 222}, /* Þ */
523 {'s', 's', 223}, /* ß */
524 {'a', '`', 224}, /* à */
525 {'a', '\'', 225}, /* á */
526 {'a', '^', 226}, /* â */
527 {'a', '~', 227}, /* ã */
528 {'a', '"', 228}, /* ä */
529 {'a', '@', 229}, /* å */
530 {'a', 'a', 229}, /* å */
531 {'a', 'e', 230}, /* æ */
532 {'c', ',', 231}, /* ç */
533 {'e', '`', 232}, /* è */
534 {'e', '\'', 233}, /* é */
535 {'e', '^', 234}, /* ê */
536 {'e', '"', 235}, /* ë */
537 {'i', '`', 236}, /* ì */
538 {'i', '\'', 237}, /* í */
539 {'i', '^', 238}, /* î */
540 {'i', '"', 239}, /* ï */
541 {'d', '-', 240}, /* ð */
542 {'n', '~', 241}, /* ñ */
543 {'o', '`', 242}, /* ò */
544 {'o', '\'', 243}, /* ó */
545 {'o', '^', 244}, /* ô */
546 {'o', '~', 245}, /* õ */
547 {'o', '"', 246}, /* ö */
548 {':', '-', 247}, /* ÷ - division symbol in ISO 8859-1 */
549 {'o', 'e', 247}, /* ÷ - oe in ISO 8859-15 */
550 {'o', '/', 248}, /* ø */
551 {'u', '`', 249}, /* ù */
552 {'u', '\'', 250}, /* ú */
553 {'u', '^', 251}, /* û */
554 {'u', '"', 252}, /* ü */
555 {'y', '\'', 253}, /* ý */
556 {'i', 'p', 254}, /* þ */
557 {'y', '"', 255}, /* x XX */
558 {NUL, NUL, NUL}
559 };
Bram Moolenaar48e330a2016-02-23 14:53:34 +0100560# else /* OLD_DIGRAPHS */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000561
562 /*
563 * digraphs for Unicode from RFC1345
564 * (also work for ISO-8859-1 aka latin1)
565 */
Bram Moolenaar071d4272004-06-13 20:20:40 +0000566 {
567 {'N', 'U', 0x0a}, /* LF for NUL */
568 {'S', 'H', 0x01},
569 {'S', 'X', 0x02},
570 {'E', 'X', 0x03},
571 {'E', 'T', 0x04},
572 {'E', 'Q', 0x05},
573 {'A', 'K', 0x06},
574 {'B', 'L', 0x07},
575 {'B', 'S', 0x08},
576 {'H', 'T', 0x09},
577 {'L', 'F', 0x0a},
578 {'V', 'T', 0x0b},
579 {'F', 'F', 0x0c},
580 {'C', 'R', 0x0d},
581 {'S', 'O', 0x0e},
582 {'S', 'I', 0x0f},
583 {'D', 'L', 0x10},
584 {'D', '1', 0x11},
585 {'D', '2', 0x12},
586 {'D', '3', 0x13},
587 {'D', '4', 0x14},
588 {'N', 'K', 0x15},
589 {'S', 'Y', 0x16},
590 {'E', 'B', 0x17},
591 {'C', 'N', 0x18},
592 {'E', 'M', 0x19},
593 {'S', 'B', 0x1a},
594 {'E', 'C', 0x1b},
595 {'F', 'S', 0x1c},
596 {'G', 'S', 0x1d},
597 {'R', 'S', 0x1e},
598 {'U', 'S', 0x1f},
599 {'S', 'P', 0x20},
600 {'N', 'b', 0x23},
601 {'D', 'O', 0x24},
602 {'A', 't', 0x40},
603 {'<', '(', 0x5b},
604 {'/', '/', 0x5c},
605 {')', '>', 0x5d},
606 {'\'', '>', 0x5e},
607 {'\'', '!', 0x60},
608 {'(', '!', 0x7b},
609 {'!', '!', 0x7c},
610 {'!', ')', 0x7d},
611 {'\'', '?', 0x7e},
612 {'D', 'T', 0x7f},
613 {'P', 'A', 0x80},
614 {'H', 'O', 0x81},
615 {'B', 'H', 0x82},
616 {'N', 'H', 0x83},
617 {'I', 'N', 0x84},
618 {'N', 'L', 0x85},
619 {'S', 'A', 0x86},
620 {'E', 'S', 0x87},
621 {'H', 'S', 0x88},
622 {'H', 'J', 0x89},
623 {'V', 'S', 0x8a},
624 {'P', 'D', 0x8b},
625 {'P', 'U', 0x8c},
626 {'R', 'I', 0x8d},
627 {'S', '2', 0x8e},
628 {'S', '3', 0x8f},
629 {'D', 'C', 0x90},
630 {'P', '1', 0x91},
631 {'P', '2', 0x92},
632 {'T', 'S', 0x93},
633 {'C', 'C', 0x94},
634 {'M', 'W', 0x95},
635 {'S', 'G', 0x96},
636 {'E', 'G', 0x97},
637 {'S', 'S', 0x98},
638 {'G', 'C', 0x99},
639 {'S', 'C', 0x9a},
640 {'C', 'I', 0x9b},
641 {'S', 'T', 0x9c},
642 {'O', 'C', 0x9d},
643 {'P', 'M', 0x9e},
644 {'A', 'C', 0x9f},
645 {'N', 'S', 0xa0},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100646#define DG_START_LATIN 0xa1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000647 {'!', 'I', 0xa1},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100648 {'~', '!', 0xa1}, // ¡ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000649 {'C', 't', 0xa2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100650 {'c', '|', 0xa2}, // ¢ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000651 {'P', 'd', 0xa3},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100652 {'$', '$', 0xa3}, // £ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000653 {'C', 'u', 0xa4},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100654 {'o', 'x', 0xa4}, // ¤ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000655 {'Y', 'e', 0xa5},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100656 {'Y', '-', 0xa5}, // ¥ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000657 {'B', 'B', 0xa6},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100658 {'|', '|', 0xa6}, // ¦ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000659 {'S', 'E', 0xa7},
660 {'\'', ':', 0xa8},
661 {'C', 'o', 0xa9},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100662 {'c', 'O', 0xa9}, // © Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000663 {'-', 'a', 0xaa},
664 {'<', '<', 0xab},
665 {'N', 'O', 0xac},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100666 {'-', ',', 0xac}, // ¬ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000667 {'-', '-', 0xad},
668 {'R', 'g', 0xae},
669 {'\'', 'm', 0xaf},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100670 {'-', '=', 0xaf}, // ¯ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000671 {'D', 'G', 0xb0},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100672 {'~', 'o', 0xb0}, // ° Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000673 {'+', '-', 0xb1},
674 {'2', 'S', 0xb2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100675 {'2', '2', 0xb2}, // ² Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000676 {'3', 'S', 0xb3},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100677 {'3', '3', 0xb3}, // ³ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000678 {'\'', '\'', 0xb4},
679 {'M', 'y', 0xb5},
680 {'P', 'I', 0xb6},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100681 {'p', 'p', 0xb6}, // ¶ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000682 {'.', 'M', 0xb7},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100683 {'~', '.', 0xb7}, // · Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000684 {'\'', ',', 0xb8},
685 {'1', 'S', 0xb9},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100686 {'1', '1', 0xb9}, // ¹ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000687 {'-', 'o', 0xba},
688 {'>', '>', 0xbb},
689 {'1', '4', 0xbc},
690 {'1', '2', 0xbd},
691 {'3', '4', 0xbe},
692 {'?', 'I', 0xbf},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100693 {'~', '?', 0xbf}, // ¿ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000694 {'A', '!', 0xc0},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100695 {'A', '`', 0xc0}, // À Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000696 {'A', '\'', 0xc1},
697 {'A', '>', 0xc2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100698 {'A', '^', 0xc2}, // Â Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000699 {'A', '?', 0xc3},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100700 {'A', '~', 0xc3}, // Ã Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000701 {'A', ':', 0xc4},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100702 {'A', '"', 0xc4}, // Ä Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000703 {'A', 'A', 0xc5},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100704 {'A', '@', 0xc5}, // Å Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000705 {'A', 'E', 0xc6},
706 {'C', ',', 0xc7},
707 {'E', '!', 0xc8},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100708 {'E', '`', 0xc8}, // È Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000709 {'E', '\'', 0xc9},
710 {'E', '>', 0xca},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100711 {'E', '^', 0xca}, // Ê Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000712 {'E', ':', 0xcb},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100713 {'E', '"', 0xcb}, // Ë Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000714 {'I', '!', 0xcc},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100715 {'I', '`', 0xcc}, // Ì Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000716 {'I', '\'', 0xcd},
717 {'I', '>', 0xce},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100718 {'I', '^', 0xce}, // Î Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000719 {'I', ':', 0xcf},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100720 {'I', '"', 0xcf}, // Ï Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000721 {'D', '-', 0xd0},
722 {'N', '?', 0xd1},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100723 {'N', '~', 0xd1}, // Ñ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000724 {'O', '!', 0xd2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100725 {'O', '`', 0xd2}, // Ò Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000726 {'O', '\'', 0xd3},
727 {'O', '>', 0xd4},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100728 {'O', '^', 0xd4}, // Ô Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000729 {'O', '?', 0xd5},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100730 {'O', '~', 0xd5}, // Õ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000731 {'O', ':', 0xd6},
732 {'*', 'X', 0xd7},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100733 {'/', '\\', 0xd7}, // × Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000734 {'O', '/', 0xd8},
735 {'U', '!', 0xd9},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100736 {'U', '`', 0xd9}, // Ù Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000737 {'U', '\'', 0xda},
738 {'U', '>', 0xdb},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100739 {'U', '^', 0xdb}, // Û Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000740 {'U', ':', 0xdc},
741 {'Y', '\'', 0xdd},
742 {'T', 'H', 0xde},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100743 {'I', 'p', 0xde}, // Þ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000744 {'s', 's', 0xdf},
745 {'a', '!', 0xe0},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100746 {'a', '`', 0xe0}, // à Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000747 {'a', '\'', 0xe1},
748 {'a', '>', 0xe2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100749 {'a', '^', 0xe2}, // â Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000750 {'a', '?', 0xe3},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100751 {'a', '~', 0xe3}, // ã Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000752 {'a', ':', 0xe4},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100753 {'a', '"', 0xe4}, // ä Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000754 {'a', 'a', 0xe5},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100755 {'a', '@', 0xe5}, // å Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000756 {'a', 'e', 0xe6},
757 {'c', ',', 0xe7},
758 {'e', '!', 0xe8},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100759 {'e', '`', 0xe8}, // è Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000760 {'e', '\'', 0xe9},
761 {'e', '>', 0xea},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100762 {'e', '^', 0xea}, // ê Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000763 {'e', ':', 0xeb},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100764 {'e', '"', 0xeb}, // ë Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000765 {'i', '!', 0xec},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100766 {'i', '`', 0xec}, // ì Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000767 {'i', '\'', 0xed},
768 {'i', '>', 0xee},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100769 {'i', '^', 0xee}, // î Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000770 {'i', ':', 0xef},
771 {'d', '-', 0xf0},
772 {'n', '?', 0xf1},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100773 {'n', '~', 0xf1}, // ñ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000774 {'o', '!', 0xf2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100775 {'o', '`', 0xf2}, // ò Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000776 {'o', '\'', 0xf3},
777 {'o', '>', 0xf4},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100778 {'o', '^', 0xf4}, // ô Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000779 {'o', '?', 0xf5},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100780 {'o', '~', 0xf5}, // õ Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000781 {'o', ':', 0xf6},
782 {'-', ':', 0xf7},
783 {'o', '/', 0xf8},
784 {'u', '!', 0xf9},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100785 {'u', '`', 0xf9}, // ù Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000786 {'u', '\'', 0xfa},
787 {'u', '>', 0xfb},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100788 {'u', '^', 0xfb}, // û Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000789 {'u', ':', 0xfc},
790 {'y', '\'', 0xfd},
791 {'t', 'h', 0xfe},
792 {'y', ':', 0xff},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100793 {'y', '"', 0xff}, // x XX Vim 5.x compatible
Bram Moolenaar071d4272004-06-13 20:20:40 +0000794
795# ifdef FEAT_MBYTE
796# define USE_UNICODE_DIGRAPHS
797
798 {'A', '-', 0x0100},
799 {'a', '-', 0x0101},
800 {'A', '(', 0x0102},
801 {'a', '(', 0x0103},
802 {'A', ';', 0x0104},
803 {'a', ';', 0x0105},
804 {'C', '\'', 0x0106},
805 {'c', '\'', 0x0107},
806 {'C', '>', 0x0108},
807 {'c', '>', 0x0109},
808 {'C', '.', 0x010a},
809 {'c', '.', 0x010b},
810 {'C', '<', 0x010c},
811 {'c', '<', 0x010d},
812 {'D', '<', 0x010e},
813 {'d', '<', 0x010f},
814 {'D', '/', 0x0110},
815 {'d', '/', 0x0111},
816 {'E', '-', 0x0112},
817 {'e', '-', 0x0113},
818 {'E', '(', 0x0114},
819 {'e', '(', 0x0115},
820 {'E', '.', 0x0116},
821 {'e', '.', 0x0117},
822 {'E', ';', 0x0118},
823 {'e', ';', 0x0119},
824 {'E', '<', 0x011a},
825 {'e', '<', 0x011b},
826 {'G', '>', 0x011c},
827 {'g', '>', 0x011d},
828 {'G', '(', 0x011e},
829 {'g', '(', 0x011f},
830 {'G', '.', 0x0120},
831 {'g', '.', 0x0121},
832 {'G', ',', 0x0122},
833 {'g', ',', 0x0123},
834 {'H', '>', 0x0124},
835 {'h', '>', 0x0125},
836 {'H', '/', 0x0126},
837 {'h', '/', 0x0127},
838 {'I', '?', 0x0128},
839 {'i', '?', 0x0129},
840 {'I', '-', 0x012a},
841 {'i', '-', 0x012b},
842 {'I', '(', 0x012c},
843 {'i', '(', 0x012d},
844 {'I', ';', 0x012e},
845 {'i', ';', 0x012f},
846 {'I', '.', 0x0130},
847 {'i', '.', 0x0131},
848 {'I', 'J', 0x0132},
849 {'i', 'j', 0x0133},
850 {'J', '>', 0x0134},
851 {'j', '>', 0x0135},
852 {'K', ',', 0x0136},
853 {'k', ',', 0x0137},
854 {'k', 'k', 0x0138},
855 {'L', '\'', 0x0139},
856 {'l', '\'', 0x013a},
857 {'L', ',', 0x013b},
858 {'l', ',', 0x013c},
859 {'L', '<', 0x013d},
860 {'l', '<', 0x013e},
861 {'L', '.', 0x013f},
862 {'l', '.', 0x0140},
863 {'L', '/', 0x0141},
864 {'l', '/', 0x0142},
865 {'N', '\'', 0x0143},
866 {'n', '\'', 0x0144},
867 {'N', ',', 0x0145},
868 {'n', ',', 0x0146},
869 {'N', '<', 0x0147},
870 {'n', '<', 0x0148},
871 {'\'', 'n', 0x0149},
872 {'N', 'G', 0x014a},
873 {'n', 'g', 0x014b},
874 {'O', '-', 0x014c},
875 {'o', '-', 0x014d},
876 {'O', '(', 0x014e},
877 {'o', '(', 0x014f},
878 {'O', '"', 0x0150},
879 {'o', '"', 0x0151},
880 {'O', 'E', 0x0152},
881 {'o', 'e', 0x0153},
882 {'R', '\'', 0x0154},
883 {'r', '\'', 0x0155},
884 {'R', ',', 0x0156},
885 {'r', ',', 0x0157},
886 {'R', '<', 0x0158},
887 {'r', '<', 0x0159},
888 {'S', '\'', 0x015a},
889 {'s', '\'', 0x015b},
890 {'S', '>', 0x015c},
891 {'s', '>', 0x015d},
892 {'S', ',', 0x015e},
893 {'s', ',', 0x015f},
894 {'S', '<', 0x0160},
895 {'s', '<', 0x0161},
896 {'T', ',', 0x0162},
897 {'t', ',', 0x0163},
898 {'T', '<', 0x0164},
899 {'t', '<', 0x0165},
900 {'T', '/', 0x0166},
901 {'t', '/', 0x0167},
902 {'U', '?', 0x0168},
903 {'u', '?', 0x0169},
904 {'U', '-', 0x016a},
905 {'u', '-', 0x016b},
906 {'U', '(', 0x016c},
907 {'u', '(', 0x016d},
908 {'U', '0', 0x016e},
909 {'u', '0', 0x016f},
910 {'U', '"', 0x0170},
911 {'u', '"', 0x0171},
912 {'U', ';', 0x0172},
913 {'u', ';', 0x0173},
914 {'W', '>', 0x0174},
915 {'w', '>', 0x0175},
916 {'Y', '>', 0x0176},
917 {'y', '>', 0x0177},
918 {'Y', ':', 0x0178},
919 {'Z', '\'', 0x0179},
920 {'z', '\'', 0x017a},
921 {'Z', '.', 0x017b},
922 {'z', '.', 0x017c},
923 {'Z', '<', 0x017d},
924 {'z', '<', 0x017e},
925 {'O', '9', 0x01a0},
926 {'o', '9', 0x01a1},
927 {'O', 'I', 0x01a2},
928 {'o', 'i', 0x01a3},
929 {'y', 'r', 0x01a6},
930 {'U', '9', 0x01af},
931 {'u', '9', 0x01b0},
932 {'Z', '/', 0x01b5},
933 {'z', '/', 0x01b6},
934 {'E', 'D', 0x01b7},
935 {'A', '<', 0x01cd},
936 {'a', '<', 0x01ce},
937 {'I', '<', 0x01cf},
938 {'i', '<', 0x01d0},
939 {'O', '<', 0x01d1},
940 {'o', '<', 0x01d2},
941 {'U', '<', 0x01d3},
942 {'u', '<', 0x01d4},
943 {'A', '1', 0x01de},
944 {'a', '1', 0x01df},
945 {'A', '7', 0x01e0},
946 {'a', '7', 0x01e1},
947 {'A', '3', 0x01e2},
948 {'a', '3', 0x01e3},
949 {'G', '/', 0x01e4},
950 {'g', '/', 0x01e5},
951 {'G', '<', 0x01e6},
952 {'g', '<', 0x01e7},
953 {'K', '<', 0x01e8},
954 {'k', '<', 0x01e9},
955 {'O', ';', 0x01ea},
956 {'o', ';', 0x01eb},
957 {'O', '1', 0x01ec},
958 {'o', '1', 0x01ed},
959 {'E', 'Z', 0x01ee},
960 {'e', 'z', 0x01ef},
961 {'j', '<', 0x01f0},
962 {'G', '\'', 0x01f4},
963 {'g', '\'', 0x01f5},
964 {';', 'S', 0x02bf},
965 {'\'', '<', 0x02c7},
966 {'\'', '(', 0x02d8},
967 {'\'', '.', 0x02d9},
968 {'\'', '0', 0x02da},
969 {'\'', ';', 0x02db},
970 {'\'', '"', 0x02dd},
Bram Moolenaareae8ae12018-12-14 18:53:02 +0100971#define DG_START_GREEK 0x0386
Bram Moolenaar071d4272004-06-13 20:20:40 +0000972 {'A', '%', 0x0386},
973 {'E', '%', 0x0388},
974 {'Y', '%', 0x0389},
975 {'I', '%', 0x038a},
976 {'O', '%', 0x038c},
977 {'U', '%', 0x038e},
978 {'W', '%', 0x038f},
979 {'i', '3', 0x0390},
980 {'A', '*', 0x0391},
981 {'B', '*', 0x0392},
982 {'G', '*', 0x0393},
983 {'D', '*', 0x0394},
984 {'E', '*', 0x0395},
985 {'Z', '*', 0x0396},
986 {'Y', '*', 0x0397},
987 {'H', '*', 0x0398},
988 {'I', '*', 0x0399},
989 {'K', '*', 0x039a},
990 {'L', '*', 0x039b},
991 {'M', '*', 0x039c},
992 {'N', '*', 0x039d},
993 {'C', '*', 0x039e},
994 {'O', '*', 0x039f},
995 {'P', '*', 0x03a0},
996 {'R', '*', 0x03a1},
997 {'S', '*', 0x03a3},
998 {'T', '*', 0x03a4},
999 {'U', '*', 0x03a5},
1000 {'F', '*', 0x03a6},
1001 {'X', '*', 0x03a7},
1002 {'Q', '*', 0x03a8},
1003 {'W', '*', 0x03a9},
1004 {'J', '*', 0x03aa},
1005 {'V', '*', 0x03ab},
1006 {'a', '%', 0x03ac},
1007 {'e', '%', 0x03ad},
1008 {'y', '%', 0x03ae},
1009 {'i', '%', 0x03af},
1010 {'u', '3', 0x03b0},
1011 {'a', '*', 0x03b1},
1012 {'b', '*', 0x03b2},
1013 {'g', '*', 0x03b3},
1014 {'d', '*', 0x03b4},
1015 {'e', '*', 0x03b5},
1016 {'z', '*', 0x03b6},
1017 {'y', '*', 0x03b7},
1018 {'h', '*', 0x03b8},
1019 {'i', '*', 0x03b9},
1020 {'k', '*', 0x03ba},
1021 {'l', '*', 0x03bb},
1022 {'m', '*', 0x03bc},
1023 {'n', '*', 0x03bd},
1024 {'c', '*', 0x03be},
1025 {'o', '*', 0x03bf},
1026 {'p', '*', 0x03c0},
1027 {'r', '*', 0x03c1},
1028 {'*', 's', 0x03c2},
1029 {'s', '*', 0x03c3},
1030 {'t', '*', 0x03c4},
1031 {'u', '*', 0x03c5},
1032 {'f', '*', 0x03c6},
1033 {'x', '*', 0x03c7},
1034 {'q', '*', 0x03c8},
1035 {'w', '*', 0x03c9},
1036 {'j', '*', 0x03ca},
1037 {'v', '*', 0x03cb},
1038 {'o', '%', 0x03cc},
1039 {'u', '%', 0x03cd},
1040 {'w', '%', 0x03ce},
1041 {'\'', 'G', 0x03d8},
1042 {',', 'G', 0x03d9},
1043 {'T', '3', 0x03da},
1044 {'t', '3', 0x03db},
1045 {'M', '3', 0x03dc},
1046 {'m', '3', 0x03dd},
1047 {'K', '3', 0x03de},
1048 {'k', '3', 0x03df},
1049 {'P', '3', 0x03e0},
1050 {'p', '3', 0x03e1},
1051 {'\'', '%', 0x03f4},
1052 {'j', '3', 0x03f5},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001053#define DG_START_CYRILLIC 0x0401
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054 {'I', 'O', 0x0401},
1055 {'D', '%', 0x0402},
1056 {'G', '%', 0x0403},
1057 {'I', 'E', 0x0404},
1058 {'D', 'S', 0x0405},
1059 {'I', 'I', 0x0406},
1060 {'Y', 'I', 0x0407},
1061 {'J', '%', 0x0408},
1062 {'L', 'J', 0x0409},
1063 {'N', 'J', 0x040a},
1064 {'T', 's', 0x040b},
1065 {'K', 'J', 0x040c},
1066 {'V', '%', 0x040e},
1067 {'D', 'Z', 0x040f},
1068 {'A', '=', 0x0410},
1069 {'B', '=', 0x0411},
1070 {'V', '=', 0x0412},
1071 {'G', '=', 0x0413},
1072 {'D', '=', 0x0414},
1073 {'E', '=', 0x0415},
1074 {'Z', '%', 0x0416},
1075 {'Z', '=', 0x0417},
1076 {'I', '=', 0x0418},
1077 {'J', '=', 0x0419},
1078 {'K', '=', 0x041a},
1079 {'L', '=', 0x041b},
1080 {'M', '=', 0x041c},
1081 {'N', '=', 0x041d},
1082 {'O', '=', 0x041e},
1083 {'P', '=', 0x041f},
1084 {'R', '=', 0x0420},
1085 {'S', '=', 0x0421},
1086 {'T', '=', 0x0422},
1087 {'U', '=', 0x0423},
1088 {'F', '=', 0x0424},
1089 {'H', '=', 0x0425},
1090 {'C', '=', 0x0426},
1091 {'C', '%', 0x0427},
1092 {'S', '%', 0x0428},
1093 {'S', 'c', 0x0429},
1094 {'=', '"', 0x042a},
1095 {'Y', '=', 0x042b},
1096 {'%', '"', 0x042c},
1097 {'J', 'E', 0x042d},
1098 {'J', 'U', 0x042e},
1099 {'J', 'A', 0x042f},
1100 {'a', '=', 0x0430},
1101 {'b', '=', 0x0431},
1102 {'v', '=', 0x0432},
1103 {'g', '=', 0x0433},
1104 {'d', '=', 0x0434},
1105 {'e', '=', 0x0435},
1106 {'z', '%', 0x0436},
1107 {'z', '=', 0x0437},
1108 {'i', '=', 0x0438},
1109 {'j', '=', 0x0439},
1110 {'k', '=', 0x043a},
1111 {'l', '=', 0x043b},
1112 {'m', '=', 0x043c},
1113 {'n', '=', 0x043d},
1114 {'o', '=', 0x043e},
1115 {'p', '=', 0x043f},
1116 {'r', '=', 0x0440},
1117 {'s', '=', 0x0441},
1118 {'t', '=', 0x0442},
1119 {'u', '=', 0x0443},
1120 {'f', '=', 0x0444},
1121 {'h', '=', 0x0445},
1122 {'c', '=', 0x0446},
1123 {'c', '%', 0x0447},
1124 {'s', '%', 0x0448},
1125 {'s', 'c', 0x0449},
1126 {'=', '\'', 0x044a},
1127 {'y', '=', 0x044b},
1128 {'%', '\'', 0x044c},
1129 {'j', 'e', 0x044d},
1130 {'j', 'u', 0x044e},
1131 {'j', 'a', 0x044f},
1132 {'i', 'o', 0x0451},
1133 {'d', '%', 0x0452},
1134 {'g', '%', 0x0453},
1135 {'i', 'e', 0x0454},
1136 {'d', 's', 0x0455},
1137 {'i', 'i', 0x0456},
1138 {'y', 'i', 0x0457},
1139 {'j', '%', 0x0458},
1140 {'l', 'j', 0x0459},
1141 {'n', 'j', 0x045a},
1142 {'t', 's', 0x045b},
1143 {'k', 'j', 0x045c},
1144 {'v', '%', 0x045e},
1145 {'d', 'z', 0x045f},
1146 {'Y', '3', 0x0462},
1147 {'y', '3', 0x0463},
1148 {'O', '3', 0x046a},
1149 {'o', '3', 0x046b},
1150 {'F', '3', 0x0472},
1151 {'f', '3', 0x0473},
1152 {'V', '3', 0x0474},
1153 {'v', '3', 0x0475},
1154 {'C', '3', 0x0480},
1155 {'c', '3', 0x0481},
1156 {'G', '3', 0x0490},
1157 {'g', '3', 0x0491},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001158#define DG_START_HEBREW 0x05d0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001159 {'A', '+', 0x05d0},
1160 {'B', '+', 0x05d1},
1161 {'G', '+', 0x05d2},
1162 {'D', '+', 0x05d3},
1163 {'H', '+', 0x05d4},
1164 {'W', '+', 0x05d5},
1165 {'Z', '+', 0x05d6},
1166 {'X', '+', 0x05d7},
1167 {'T', 'j', 0x05d8},
1168 {'J', '+', 0x05d9},
1169 {'K', '%', 0x05da},
1170 {'K', '+', 0x05db},
1171 {'L', '+', 0x05dc},
1172 {'M', '%', 0x05dd},
1173 {'M', '+', 0x05de},
1174 {'N', '%', 0x05df},
1175 {'N', '+', 0x05e0},
1176 {'S', '+', 0x05e1},
1177 {'E', '+', 0x05e2},
1178 {'P', '%', 0x05e3},
1179 {'P', '+', 0x05e4},
1180 {'Z', 'j', 0x05e5},
1181 {'Z', 'J', 0x05e6},
1182 {'Q', '+', 0x05e7},
1183 {'R', '+', 0x05e8},
1184 {'S', 'h', 0x05e9},
1185 {'T', '+', 0x05ea},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001186#define DG_START_ARABIC 0x060c
Bram Moolenaar071d4272004-06-13 20:20:40 +00001187 {',', '+', 0x060c},
1188 {';', '+', 0x061b},
1189 {'?', '+', 0x061f},
1190 {'H', '\'', 0x0621},
1191 {'a', 'M', 0x0622},
1192 {'a', 'H', 0x0623},
1193 {'w', 'H', 0x0624},
1194 {'a', 'h', 0x0625},
1195 {'y', 'H', 0x0626},
1196 {'a', '+', 0x0627},
1197 {'b', '+', 0x0628},
1198 {'t', 'm', 0x0629},
1199 {'t', '+', 0x062a},
1200 {'t', 'k', 0x062b},
1201 {'g', '+', 0x062c},
1202 {'h', 'k', 0x062d},
1203 {'x', '+', 0x062e},
1204 {'d', '+', 0x062f},
1205 {'d', 'k', 0x0630},
1206 {'r', '+', 0x0631},
1207 {'z', '+', 0x0632},
1208 {'s', '+', 0x0633},
1209 {'s', 'n', 0x0634},
1210 {'c', '+', 0x0635},
1211 {'d', 'd', 0x0636},
1212 {'t', 'j', 0x0637},
1213 {'z', 'H', 0x0638},
1214 {'e', '+', 0x0639},
1215 {'i', '+', 0x063a},
1216 {'+', '+', 0x0640},
1217 {'f', '+', 0x0641},
1218 {'q', '+', 0x0642},
1219 {'k', '+', 0x0643},
1220 {'l', '+', 0x0644},
1221 {'m', '+', 0x0645},
1222 {'n', '+', 0x0646},
1223 {'h', '+', 0x0647},
1224 {'w', '+', 0x0648},
1225 {'j', '+', 0x0649},
1226 {'y', '+', 0x064a},
1227 {':', '+', 0x064b},
1228 {'"', '+', 0x064c},
1229 {'=', '+', 0x064d},
1230 {'/', '+', 0x064e},
1231 {'\'', '+', 0x064f},
1232 {'1', '+', 0x0650},
1233 {'3', '+', 0x0651},
1234 {'0', '+', 0x0652},
1235 {'a', 'S', 0x0670},
1236 {'p', '+', 0x067e},
1237 {'v', '+', 0x06a4},
1238 {'g', 'f', 0x06af},
1239 {'0', 'a', 0x06f0},
1240 {'1', 'a', 0x06f1},
1241 {'2', 'a', 0x06f2},
1242 {'3', 'a', 0x06f3},
1243 {'4', 'a', 0x06f4},
1244 {'5', 'a', 0x06f5},
1245 {'6', 'a', 0x06f6},
1246 {'7', 'a', 0x06f7},
1247 {'8', 'a', 0x06f8},
1248 {'9', 'a', 0x06f9},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001249#define DG_START_LATIN_EXTENDED 0x1e02
Bram Moolenaar071d4272004-06-13 20:20:40 +00001250 {'B', '.', 0x1e02},
1251 {'b', '.', 0x1e03},
1252 {'B', '_', 0x1e06},
1253 {'b', '_', 0x1e07},
1254 {'D', '.', 0x1e0a},
1255 {'d', '.', 0x1e0b},
1256 {'D', '_', 0x1e0e},
1257 {'d', '_', 0x1e0f},
1258 {'D', ',', 0x1e10},
1259 {'d', ',', 0x1e11},
1260 {'F', '.', 0x1e1e},
1261 {'f', '.', 0x1e1f},
1262 {'G', '-', 0x1e20},
1263 {'g', '-', 0x1e21},
1264 {'H', '.', 0x1e22},
1265 {'h', '.', 0x1e23},
1266 {'H', ':', 0x1e26},
1267 {'h', ':', 0x1e27},
1268 {'H', ',', 0x1e28},
1269 {'h', ',', 0x1e29},
1270 {'K', '\'', 0x1e30},
1271 {'k', '\'', 0x1e31},
1272 {'K', '_', 0x1e34},
1273 {'k', '_', 0x1e35},
1274 {'L', '_', 0x1e3a},
1275 {'l', '_', 0x1e3b},
1276 {'M', '\'', 0x1e3e},
1277 {'m', '\'', 0x1e3f},
1278 {'M', '.', 0x1e40},
1279 {'m', '.', 0x1e41},
1280 {'N', '.', 0x1e44},
1281 {'n', '.', 0x1e45},
1282 {'N', '_', 0x1e48},
1283 {'n', '_', 0x1e49},
1284 {'P', '\'', 0x1e54},
1285 {'p', '\'', 0x1e55},
1286 {'P', '.', 0x1e56},
1287 {'p', '.', 0x1e57},
1288 {'R', '.', 0x1e58},
1289 {'r', '.', 0x1e59},
1290 {'R', '_', 0x1e5e},
1291 {'r', '_', 0x1e5f},
1292 {'S', '.', 0x1e60},
1293 {'s', '.', 0x1e61},
1294 {'T', '.', 0x1e6a},
1295 {'t', '.', 0x1e6b},
1296 {'T', '_', 0x1e6e},
1297 {'t', '_', 0x1e6f},
1298 {'V', '?', 0x1e7c},
1299 {'v', '?', 0x1e7d},
1300 {'W', '!', 0x1e80},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001301 {'W', '`', 0x1e80}, // extra alternative, easier to remember
Bram Moolenaar071d4272004-06-13 20:20:40 +00001302 {'w', '!', 0x1e81},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001303 {'w', '`', 0x1e81}, // extra alternative, easier to remember
Bram Moolenaar071d4272004-06-13 20:20:40 +00001304 {'W', '\'', 0x1e82},
1305 {'w', '\'', 0x1e83},
1306 {'W', ':', 0x1e84},
1307 {'w', ':', 0x1e85},
1308 {'W', '.', 0x1e86},
1309 {'w', '.', 0x1e87},
1310 {'X', '.', 0x1e8a},
1311 {'x', '.', 0x1e8b},
1312 {'X', ':', 0x1e8c},
1313 {'x', ':', 0x1e8d},
1314 {'Y', '.', 0x1e8e},
1315 {'y', '.', 0x1e8f},
1316 {'Z', '>', 0x1e90},
1317 {'z', '>', 0x1e91},
1318 {'Z', '_', 0x1e94},
1319 {'z', '_', 0x1e95},
1320 {'h', '_', 0x1e96},
1321 {'t', ':', 0x1e97},
1322 {'w', '0', 0x1e98},
1323 {'y', '0', 0x1e99},
1324 {'A', '2', 0x1ea2},
1325 {'a', '2', 0x1ea3},
1326 {'E', '2', 0x1eba},
1327 {'e', '2', 0x1ebb},
1328 {'E', '?', 0x1ebc},
1329 {'e', '?', 0x1ebd},
1330 {'I', '2', 0x1ec8},
1331 {'i', '2', 0x1ec9},
1332 {'O', '2', 0x1ece},
1333 {'o', '2', 0x1ecf},
1334 {'U', '2', 0x1ee6},
1335 {'u', '2', 0x1ee7},
1336 {'Y', '!', 0x1ef2},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001337 {'Y', '`', 0x1ef2}, // extra alternative, easier to remember
Bram Moolenaar071d4272004-06-13 20:20:40 +00001338 {'y', '!', 0x1ef3},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001339 {'y', '`', 0x1ef3}, // extra alternative, easier to remember
Bram Moolenaar071d4272004-06-13 20:20:40 +00001340 {'Y', '2', 0x1ef6},
1341 {'y', '2', 0x1ef7},
1342 {'Y', '?', 0x1ef8},
1343 {'y', '?', 0x1ef9},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001344#define DG_START_GREEK_EXTENDED 0x1f00
Bram Moolenaar071d4272004-06-13 20:20:40 +00001345 {';', '\'', 0x1f00},
1346 {',', '\'', 0x1f01},
1347 {';', '!', 0x1f02},
1348 {',', '!', 0x1f03},
1349 {'?', ';', 0x1f04},
1350 {'?', ',', 0x1f05},
1351 {'!', ':', 0x1f06},
1352 {'?', ':', 0x1f07},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001353#define DG_START_PUNCTUATION 0x2002
Bram Moolenaar071d4272004-06-13 20:20:40 +00001354 {'1', 'N', 0x2002},
1355 {'1', 'M', 0x2003},
1356 {'3', 'M', 0x2004},
1357 {'4', 'M', 0x2005},
1358 {'6', 'M', 0x2006},
1359 {'1', 'T', 0x2009},
1360 {'1', 'H', 0x200a},
1361 {'-', '1', 0x2010},
1362 {'-', 'N', 0x2013},
1363 {'-', 'M', 0x2014},
1364 {'-', '3', 0x2015},
1365 {'!', '2', 0x2016},
1366 {'=', '2', 0x2017},
1367 {'\'', '6', 0x2018},
1368 {'\'', '9', 0x2019},
1369 {'.', '9', 0x201a},
1370 {'9', '\'', 0x201b},
1371 {'"', '6', 0x201c},
1372 {'"', '9', 0x201d},
1373 {':', '9', 0x201e},
1374 {'9', '"', 0x201f},
1375 {'/', '-', 0x2020},
1376 {'/', '=', 0x2021},
1377 {'.', '.', 0x2025},
Bram Moolenaar81615512016-11-04 22:17:16 +01001378 {',', '.', 0x2026},
Bram Moolenaar071d4272004-06-13 20:20:40 +00001379 {'%', '0', 0x2030},
1380 {'1', '\'', 0x2032},
1381 {'2', '\'', 0x2033},
1382 {'3', '\'', 0x2034},
1383 {'1', '"', 0x2035},
1384 {'2', '"', 0x2036},
1385 {'3', '"', 0x2037},
1386 {'C', 'a', 0x2038},
1387 {'<', '1', 0x2039},
1388 {'>', '1', 0x203a},
1389 {':', 'X', 0x203b},
1390 {'\'', '-', 0x203e},
1391 {'/', 'f', 0x2044},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001392#define DG_START_SUB_SUPER 0x2070
Bram Moolenaar071d4272004-06-13 20:20:40 +00001393 {'0', 'S', 0x2070},
1394 {'4', 'S', 0x2074},
1395 {'5', 'S', 0x2075},
1396 {'6', 'S', 0x2076},
1397 {'7', 'S', 0x2077},
1398 {'8', 'S', 0x2078},
1399 {'9', 'S', 0x2079},
1400 {'+', 'S', 0x207a},
1401 {'-', 'S', 0x207b},
1402 {'=', 'S', 0x207c},
1403 {'(', 'S', 0x207d},
1404 {')', 'S', 0x207e},
1405 {'n', 'S', 0x207f},
1406 {'0', 's', 0x2080},
1407 {'1', 's', 0x2081},
1408 {'2', 's', 0x2082},
1409 {'3', 's', 0x2083},
1410 {'4', 's', 0x2084},
1411 {'5', 's', 0x2085},
1412 {'6', 's', 0x2086},
1413 {'7', 's', 0x2087},
1414 {'8', 's', 0x2088},
1415 {'9', 's', 0x2089},
1416 {'+', 's', 0x208a},
1417 {'-', 's', 0x208b},
1418 {'=', 's', 0x208c},
1419 {'(', 's', 0x208d},
1420 {')', 's', 0x208e},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001421#define DG_START_CURRENCY 0x20a4
Bram Moolenaar071d4272004-06-13 20:20:40 +00001422 {'L', 'i', 0x20a4},
1423 {'P', 't', 0x20a7},
1424 {'W', '=', 0x20a9},
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001425 {'=', 'e', 0x20ac}, /* euro */
Bram Moolenaarf75a9632005-09-13 21:20:47 +00001426 {'E', 'u', 0x20ac}, /* euro */
Bram Moolenaare8d1f202014-06-18 21:38:18 +02001427 {'=', 'R', 0x20bd}, /* rouble */
1428 {'=', 'P', 0x20bd}, /* rouble */
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001429#define DG_START_OTHER1 0x2103
Bram Moolenaar071d4272004-06-13 20:20:40 +00001430 {'o', 'C', 0x2103},
1431 {'c', 'o', 0x2105},
1432 {'o', 'F', 0x2109},
1433 {'N', '0', 0x2116},
1434 {'P', 'O', 0x2117},
1435 {'R', 'x', 0x211e},
1436 {'S', 'M', 0x2120},
1437 {'T', 'M', 0x2122},
1438 {'O', 'm', 0x2126},
1439 {'A', 'O', 0x212b},
1440 {'1', '3', 0x2153},
1441 {'2', '3', 0x2154},
1442 {'1', '5', 0x2155},
1443 {'2', '5', 0x2156},
1444 {'3', '5', 0x2157},
1445 {'4', '5', 0x2158},
1446 {'1', '6', 0x2159},
1447 {'5', '6', 0x215a},
1448 {'1', '8', 0x215b},
1449 {'3', '8', 0x215c},
1450 {'5', '8', 0x215d},
1451 {'7', '8', 0x215e},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001452#define DG_START_ROMAN 0x2160
Bram Moolenaar071d4272004-06-13 20:20:40 +00001453 {'1', 'R', 0x2160},
1454 {'2', 'R', 0x2161},
1455 {'3', 'R', 0x2162},
1456 {'4', 'R', 0x2163},
1457 {'5', 'R', 0x2164},
1458 {'6', 'R', 0x2165},
1459 {'7', 'R', 0x2166},
1460 {'8', 'R', 0x2167},
1461 {'9', 'R', 0x2168},
1462 {'a', 'R', 0x2169},
1463 {'b', 'R', 0x216a},
1464 {'c', 'R', 0x216b},
1465 {'1', 'r', 0x2170},
1466 {'2', 'r', 0x2171},
1467 {'3', 'r', 0x2172},
1468 {'4', 'r', 0x2173},
1469 {'5', 'r', 0x2174},
1470 {'6', 'r', 0x2175},
1471 {'7', 'r', 0x2176},
1472 {'8', 'r', 0x2177},
1473 {'9', 'r', 0x2178},
1474 {'a', 'r', 0x2179},
1475 {'b', 'r', 0x217a},
1476 {'c', 'r', 0x217b},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001477#define DG_START_ARROWS 0x2190
Bram Moolenaar071d4272004-06-13 20:20:40 +00001478 {'<', '-', 0x2190},
1479 {'-', '!', 0x2191},
1480 {'-', '>', 0x2192},
1481 {'-', 'v', 0x2193},
1482 {'<', '>', 0x2194},
1483 {'U', 'D', 0x2195},
1484 {'<', '=', 0x21d0},
1485 {'=', '>', 0x21d2},
1486 {'=', '=', 0x21d4},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001487#define DG_START_MATH 0x2200
Bram Moolenaar071d4272004-06-13 20:20:40 +00001488 {'F', 'A', 0x2200},
1489 {'d', 'P', 0x2202},
1490 {'T', 'E', 0x2203},
1491 {'/', '0', 0x2205},
1492 {'D', 'E', 0x2206},
1493 {'N', 'B', 0x2207},
1494 {'(', '-', 0x2208},
1495 {'-', ')', 0x220b},
1496 {'*', 'P', 0x220f},
1497 {'+', 'Z', 0x2211},
1498 {'-', '2', 0x2212},
1499 {'-', '+', 0x2213},
1500 {'*', '-', 0x2217},
1501 {'O', 'b', 0x2218},
1502 {'S', 'b', 0x2219},
1503 {'R', 'T', 0x221a},
1504 {'0', '(', 0x221d},
1505 {'0', '0', 0x221e},
1506 {'-', 'L', 0x221f},
1507 {'-', 'V', 0x2220},
1508 {'P', 'P', 0x2225},
1509 {'A', 'N', 0x2227},
1510 {'O', 'R', 0x2228},
1511 {'(', 'U', 0x2229},
1512 {')', 'U', 0x222a},
1513 {'I', 'n', 0x222b},
1514 {'D', 'I', 0x222c},
1515 {'I', 'o', 0x222e},
1516 {'.', ':', 0x2234},
1517 {':', '.', 0x2235},
1518 {':', 'R', 0x2236},
1519 {':', ':', 0x2237},
1520 {'?', '1', 0x223c},
1521 {'C', 'G', 0x223e},
1522 {'?', '-', 0x2243},
1523 {'?', '=', 0x2245},
1524 {'?', '2', 0x2248},
1525 {'=', '?', 0x224c},
1526 {'H', 'I', 0x2253},
1527 {'!', '=', 0x2260},
1528 {'=', '3', 0x2261},
1529 {'=', '<', 0x2264},
1530 {'>', '=', 0x2265},
1531 {'<', '*', 0x226a},
1532 {'*', '>', 0x226b},
1533 {'!', '<', 0x226e},
1534 {'!', '>', 0x226f},
1535 {'(', 'C', 0x2282},
1536 {')', 'C', 0x2283},
1537 {'(', '_', 0x2286},
1538 {')', '_', 0x2287},
1539 {'0', '.', 0x2299},
1540 {'0', '2', 0x229a},
1541 {'-', 'T', 0x22a5},
1542 {'.', 'P', 0x22c5},
1543 {':', '3', 0x22ee},
1544 {'.', '3', 0x22ef},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001545#define DG_START_TECHNICAL 0x2302
Bram Moolenaar071d4272004-06-13 20:20:40 +00001546 {'E', 'h', 0x2302},
1547 {'<', '7', 0x2308},
1548 {'>', '7', 0x2309},
1549 {'7', '<', 0x230a},
1550 {'7', '>', 0x230b},
1551 {'N', 'I', 0x2310},
1552 {'(', 'A', 0x2312},
1553 {'T', 'R', 0x2315},
1554 {'I', 'u', 0x2320},
1555 {'I', 'l', 0x2321},
1556 {'<', '/', 0x2329},
1557 {'/', '>', 0x232a},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001558#define DG_START_OTHER2 0x2423
Bram Moolenaar071d4272004-06-13 20:20:40 +00001559 {'V', 's', 0x2423},
1560 {'1', 'h', 0x2440},
1561 {'3', 'h', 0x2441},
1562 {'2', 'h', 0x2442},
1563 {'4', 'h', 0x2443},
1564 {'1', 'j', 0x2446},
1565 {'2', 'j', 0x2447},
1566 {'3', 'j', 0x2448},
1567 {'4', 'j', 0x2449},
1568 {'1', '.', 0x2488},
1569 {'2', '.', 0x2489},
1570 {'3', '.', 0x248a},
1571 {'4', '.', 0x248b},
1572 {'5', '.', 0x248c},
1573 {'6', '.', 0x248d},
1574 {'7', '.', 0x248e},
1575 {'8', '.', 0x248f},
1576 {'9', '.', 0x2490},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001577#define DG_START_DRAWING 0x2500
Bram Moolenaar071d4272004-06-13 20:20:40 +00001578 {'h', 'h', 0x2500},
1579 {'H', 'H', 0x2501},
1580 {'v', 'v', 0x2502},
1581 {'V', 'V', 0x2503},
1582 {'3', '-', 0x2504},
1583 {'3', '_', 0x2505},
1584 {'3', '!', 0x2506},
1585 {'3', '/', 0x2507},
1586 {'4', '-', 0x2508},
1587 {'4', '_', 0x2509},
1588 {'4', '!', 0x250a},
1589 {'4', '/', 0x250b},
1590 {'d', 'r', 0x250c},
1591 {'d', 'R', 0x250d},
1592 {'D', 'r', 0x250e},
1593 {'D', 'R', 0x250f},
1594 {'d', 'l', 0x2510},
1595 {'d', 'L', 0x2511},
1596 {'D', 'l', 0x2512},
1597 {'L', 'D', 0x2513},
1598 {'u', 'r', 0x2514},
1599 {'u', 'R', 0x2515},
1600 {'U', 'r', 0x2516},
1601 {'U', 'R', 0x2517},
1602 {'u', 'l', 0x2518},
1603 {'u', 'L', 0x2519},
1604 {'U', 'l', 0x251a},
1605 {'U', 'L', 0x251b},
1606 {'v', 'r', 0x251c},
1607 {'v', 'R', 0x251d},
1608 {'V', 'r', 0x2520},
1609 {'V', 'R', 0x2523},
1610 {'v', 'l', 0x2524},
1611 {'v', 'L', 0x2525},
1612 {'V', 'l', 0x2528},
1613 {'V', 'L', 0x252b},
1614 {'d', 'h', 0x252c},
1615 {'d', 'H', 0x252f},
1616 {'D', 'h', 0x2530},
1617 {'D', 'H', 0x2533},
1618 {'u', 'h', 0x2534},
1619 {'u', 'H', 0x2537},
1620 {'U', 'h', 0x2538},
1621 {'U', 'H', 0x253b},
1622 {'v', 'h', 0x253c},
1623 {'v', 'H', 0x253f},
1624 {'V', 'h', 0x2542},
1625 {'V', 'H', 0x254b},
1626 {'F', 'D', 0x2571},
1627 {'B', 'D', 0x2572},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001628#define DG_START_BLOCK 0x2580
Bram Moolenaar071d4272004-06-13 20:20:40 +00001629 {'T', 'B', 0x2580},
1630 {'L', 'B', 0x2584},
1631 {'F', 'B', 0x2588},
1632 {'l', 'B', 0x258c},
1633 {'R', 'B', 0x2590},
1634 {'.', 'S', 0x2591},
1635 {':', 'S', 0x2592},
1636 {'?', 'S', 0x2593},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001637#define DG_START_SHAPES 0x25a0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001638 {'f', 'S', 0x25a0},
1639 {'O', 'S', 0x25a1},
1640 {'R', 'O', 0x25a2},
1641 {'R', 'r', 0x25a3},
1642 {'R', 'F', 0x25a4},
1643 {'R', 'Y', 0x25a5},
1644 {'R', 'H', 0x25a6},
1645 {'R', 'Z', 0x25a7},
1646 {'R', 'K', 0x25a8},
1647 {'R', 'X', 0x25a9},
1648 {'s', 'B', 0x25aa},
1649 {'S', 'R', 0x25ac},
1650 {'O', 'r', 0x25ad},
1651 {'U', 'T', 0x25b2},
1652 {'u', 'T', 0x25b3},
1653 {'P', 'R', 0x25b6},
1654 {'T', 'r', 0x25b7},
1655 {'D', 't', 0x25bc},
1656 {'d', 'T', 0x25bd},
1657 {'P', 'L', 0x25c0},
1658 {'T', 'l', 0x25c1},
1659 {'D', 'b', 0x25c6},
1660 {'D', 'w', 0x25c7},
1661 {'L', 'Z', 0x25ca},
1662 {'0', 'm', 0x25cb},
1663 {'0', 'o', 0x25ce},
1664 {'0', 'M', 0x25cf},
1665 {'0', 'L', 0x25d0},
1666 {'0', 'R', 0x25d1},
1667 {'S', 'n', 0x25d8},
1668 {'I', 'c', 0x25d9},
1669 {'F', 'd', 0x25e2},
1670 {'B', 'd', 0x25e3},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001671#define DG_START_SYMBOLS 0x2605
Bram Moolenaar071d4272004-06-13 20:20:40 +00001672 {'*', '2', 0x2605},
1673 {'*', '1', 0x2606},
1674 {'<', 'H', 0x261c},
1675 {'>', 'H', 0x261e},
1676 {'0', 'u', 0x263a},
1677 {'0', 'U', 0x263b},
1678 {'S', 'U', 0x263c},
1679 {'F', 'm', 0x2640},
1680 {'M', 'l', 0x2642},
1681 {'c', 'S', 0x2660},
1682 {'c', 'H', 0x2661},
1683 {'c', 'D', 0x2662},
1684 {'c', 'C', 0x2663},
1685 {'M', 'd', 0x2669},
1686 {'M', '8', 0x266a},
1687 {'M', '2', 0x266b},
1688 {'M', 'b', 0x266d},
1689 {'M', 'x', 0x266e},
1690 {'M', 'X', 0x266f},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001691#define DG_START_DINGBATS 0x2713
Bram Moolenaar071d4272004-06-13 20:20:40 +00001692 {'O', 'K', 0x2713},
1693 {'X', 'X', 0x2717},
1694 {'-', 'X', 0x2720},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001695#define DG_START_CJK_SYMBOLS 0x3000
Bram Moolenaar071d4272004-06-13 20:20:40 +00001696 {'I', 'S', 0x3000},
1697 {',', '_', 0x3001},
1698 {'.', '_', 0x3002},
1699 {'+', '"', 0x3003},
1700 {'+', '_', 0x3004},
1701 {'*', '_', 0x3005},
1702 {';', '_', 0x3006},
1703 {'0', '_', 0x3007},
1704 {'<', '+', 0x300a},
1705 {'>', '+', 0x300b},
1706 {'<', '\'', 0x300c},
1707 {'>', '\'', 0x300d},
1708 {'<', '"', 0x300e},
1709 {'>', '"', 0x300f},
1710 {'(', '"', 0x3010},
1711 {')', '"', 0x3011},
1712 {'=', 'T', 0x3012},
1713 {'=', '_', 0x3013},
1714 {'(', '\'', 0x3014},
1715 {')', '\'', 0x3015},
1716 {'(', 'I', 0x3016},
1717 {')', 'I', 0x3017},
1718 {'-', '?', 0x301c},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001719#define DG_START_HIRAGANA 0x3041
Bram Moolenaar071d4272004-06-13 20:20:40 +00001720 {'A', '5', 0x3041},
1721 {'a', '5', 0x3042},
1722 {'I', '5', 0x3043},
1723 {'i', '5', 0x3044},
1724 {'U', '5', 0x3045},
1725 {'u', '5', 0x3046},
1726 {'E', '5', 0x3047},
1727 {'e', '5', 0x3048},
1728 {'O', '5', 0x3049},
1729 {'o', '5', 0x304a},
1730 {'k', 'a', 0x304b},
1731 {'g', 'a', 0x304c},
1732 {'k', 'i', 0x304d},
1733 {'g', 'i', 0x304e},
1734 {'k', 'u', 0x304f},
1735 {'g', 'u', 0x3050},
1736 {'k', 'e', 0x3051},
1737 {'g', 'e', 0x3052},
1738 {'k', 'o', 0x3053},
1739 {'g', 'o', 0x3054},
1740 {'s', 'a', 0x3055},
1741 {'z', 'a', 0x3056},
1742 {'s', 'i', 0x3057},
1743 {'z', 'i', 0x3058},
1744 {'s', 'u', 0x3059},
1745 {'z', 'u', 0x305a},
1746 {'s', 'e', 0x305b},
1747 {'z', 'e', 0x305c},
1748 {'s', 'o', 0x305d},
1749 {'z', 'o', 0x305e},
1750 {'t', 'a', 0x305f},
1751 {'d', 'a', 0x3060},
1752 {'t', 'i', 0x3061},
1753 {'d', 'i', 0x3062},
1754 {'t', 'U', 0x3063},
1755 {'t', 'u', 0x3064},
1756 {'d', 'u', 0x3065},
1757 {'t', 'e', 0x3066},
1758 {'d', 'e', 0x3067},
1759 {'t', 'o', 0x3068},
1760 {'d', 'o', 0x3069},
1761 {'n', 'a', 0x306a},
1762 {'n', 'i', 0x306b},
1763 {'n', 'u', 0x306c},
1764 {'n', 'e', 0x306d},
1765 {'n', 'o', 0x306e},
1766 {'h', 'a', 0x306f},
1767 {'b', 'a', 0x3070},
1768 {'p', 'a', 0x3071},
1769 {'h', 'i', 0x3072},
1770 {'b', 'i', 0x3073},
1771 {'p', 'i', 0x3074},
1772 {'h', 'u', 0x3075},
1773 {'b', 'u', 0x3076},
1774 {'p', 'u', 0x3077},
1775 {'h', 'e', 0x3078},
1776 {'b', 'e', 0x3079},
1777 {'p', 'e', 0x307a},
1778 {'h', 'o', 0x307b},
1779 {'b', 'o', 0x307c},
1780 {'p', 'o', 0x307d},
1781 {'m', 'a', 0x307e},
1782 {'m', 'i', 0x307f},
1783 {'m', 'u', 0x3080},
1784 {'m', 'e', 0x3081},
1785 {'m', 'o', 0x3082},
1786 {'y', 'A', 0x3083},
1787 {'y', 'a', 0x3084},
1788 {'y', 'U', 0x3085},
1789 {'y', 'u', 0x3086},
1790 {'y', 'O', 0x3087},
1791 {'y', 'o', 0x3088},
1792 {'r', 'a', 0x3089},
1793 {'r', 'i', 0x308a},
1794 {'r', 'u', 0x308b},
1795 {'r', 'e', 0x308c},
1796 {'r', 'o', 0x308d},
1797 {'w', 'A', 0x308e},
1798 {'w', 'a', 0x308f},
1799 {'w', 'i', 0x3090},
1800 {'w', 'e', 0x3091},
1801 {'w', 'o', 0x3092},
1802 {'n', '5', 0x3093},
1803 {'v', 'u', 0x3094},
1804 {'"', '5', 0x309b},
1805 {'0', '5', 0x309c},
1806 {'*', '5', 0x309d},
1807 {'+', '5', 0x309e},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001808#define DG_START_KATAKANA 0x30a1
Bram Moolenaar071d4272004-06-13 20:20:40 +00001809 {'a', '6', 0x30a1},
1810 {'A', '6', 0x30a2},
1811 {'i', '6', 0x30a3},
1812 {'I', '6', 0x30a4},
1813 {'u', '6', 0x30a5},
1814 {'U', '6', 0x30a6},
1815 {'e', '6', 0x30a7},
1816 {'E', '6', 0x30a8},
1817 {'o', '6', 0x30a9},
1818 {'O', '6', 0x30aa},
1819 {'K', 'a', 0x30ab},
1820 {'G', 'a', 0x30ac},
1821 {'K', 'i', 0x30ad},
1822 {'G', 'i', 0x30ae},
1823 {'K', 'u', 0x30af},
1824 {'G', 'u', 0x30b0},
1825 {'K', 'e', 0x30b1},
1826 {'G', 'e', 0x30b2},
1827 {'K', 'o', 0x30b3},
1828 {'G', 'o', 0x30b4},
1829 {'S', 'a', 0x30b5},
1830 {'Z', 'a', 0x30b6},
1831 {'S', 'i', 0x30b7},
1832 {'Z', 'i', 0x30b8},
1833 {'S', 'u', 0x30b9},
1834 {'Z', 'u', 0x30ba},
1835 {'S', 'e', 0x30bb},
1836 {'Z', 'e', 0x30bc},
1837 {'S', 'o', 0x30bd},
1838 {'Z', 'o', 0x30be},
1839 {'T', 'a', 0x30bf},
1840 {'D', 'a', 0x30c0},
1841 {'T', 'i', 0x30c1},
1842 {'D', 'i', 0x30c2},
1843 {'T', 'U', 0x30c3},
1844 {'T', 'u', 0x30c4},
1845 {'D', 'u', 0x30c5},
1846 {'T', 'e', 0x30c6},
1847 {'D', 'e', 0x30c7},
1848 {'T', 'o', 0x30c8},
1849 {'D', 'o', 0x30c9},
1850 {'N', 'a', 0x30ca},
1851 {'N', 'i', 0x30cb},
1852 {'N', 'u', 0x30cc},
1853 {'N', 'e', 0x30cd},
1854 {'N', 'o', 0x30ce},
1855 {'H', 'a', 0x30cf},
1856 {'B', 'a', 0x30d0},
1857 {'P', 'a', 0x30d1},
1858 {'H', 'i', 0x30d2},
1859 {'B', 'i', 0x30d3},
1860 {'P', 'i', 0x30d4},
1861 {'H', 'u', 0x30d5},
1862 {'B', 'u', 0x30d6},
1863 {'P', 'u', 0x30d7},
1864 {'H', 'e', 0x30d8},
1865 {'B', 'e', 0x30d9},
1866 {'P', 'e', 0x30da},
1867 {'H', 'o', 0x30db},
1868 {'B', 'o', 0x30dc},
1869 {'P', 'o', 0x30dd},
1870 {'M', 'a', 0x30de},
1871 {'M', 'i', 0x30df},
1872 {'M', 'u', 0x30e0},
1873 {'M', 'e', 0x30e1},
1874 {'M', 'o', 0x30e2},
1875 {'Y', 'A', 0x30e3},
1876 {'Y', 'a', 0x30e4},
1877 {'Y', 'U', 0x30e5},
1878 {'Y', 'u', 0x30e6},
1879 {'Y', 'O', 0x30e7},
1880 {'Y', 'o', 0x30e8},
1881 {'R', 'a', 0x30e9},
1882 {'R', 'i', 0x30ea},
1883 {'R', 'u', 0x30eb},
1884 {'R', 'e', 0x30ec},
1885 {'R', 'o', 0x30ed},
1886 {'W', 'A', 0x30ee},
1887 {'W', 'a', 0x30ef},
1888 {'W', 'i', 0x30f0},
1889 {'W', 'e', 0x30f1},
1890 {'W', 'o', 0x30f2},
1891 {'N', '6', 0x30f3},
1892 {'V', 'u', 0x30f4},
1893 {'K', 'A', 0x30f5},
1894 {'K', 'E', 0x30f6},
1895 {'V', 'a', 0x30f7},
1896 {'V', 'i', 0x30f8},
1897 {'V', 'e', 0x30f9},
1898 {'V', 'o', 0x30fa},
1899 {'.', '6', 0x30fb},
1900 {'-', '6', 0x30fc},
1901 {'*', '6', 0x30fd},
1902 {'+', '6', 0x30fe},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001903#define DG_START_BOPOMOFO 0x3105
Bram Moolenaar071d4272004-06-13 20:20:40 +00001904 {'b', '4', 0x3105},
1905 {'p', '4', 0x3106},
1906 {'m', '4', 0x3107},
1907 {'f', '4', 0x3108},
1908 {'d', '4', 0x3109},
1909 {'t', '4', 0x310a},
1910 {'n', '4', 0x310b},
1911 {'l', '4', 0x310c},
1912 {'g', '4', 0x310d},
1913 {'k', '4', 0x310e},
1914 {'h', '4', 0x310f},
1915 {'j', '4', 0x3110},
1916 {'q', '4', 0x3111},
1917 {'x', '4', 0x3112},
1918 {'z', 'h', 0x3113},
1919 {'c', 'h', 0x3114},
1920 {'s', 'h', 0x3115},
1921 {'r', '4', 0x3116},
1922 {'z', '4', 0x3117},
1923 {'c', '4', 0x3118},
1924 {'s', '4', 0x3119},
1925 {'a', '4', 0x311a},
1926 {'o', '4', 0x311b},
1927 {'e', '4', 0x311c},
1928 {'a', 'i', 0x311e},
1929 {'e', 'i', 0x311f},
1930 {'a', 'u', 0x3120},
1931 {'o', 'u', 0x3121},
1932 {'a', 'n', 0x3122},
1933 {'e', 'n', 0x3123},
1934 {'a', 'N', 0x3124},
1935 {'e', 'N', 0x3125},
1936 {'e', 'r', 0x3126},
1937 {'i', '4', 0x3127},
1938 {'u', '4', 0x3128},
1939 {'i', 'u', 0x3129},
1940 {'v', '4', 0x312a},
1941 {'n', 'G', 0x312b},
1942 {'g', 'n', 0x312c},
Bram Moolenaareae8ae12018-12-14 18:53:02 +01001943#define DG_START_OTHER3 0x3220
Bram Moolenaar071d4272004-06-13 20:20:40 +00001944 {'1', 'c', 0x3220},
1945 {'2', 'c', 0x3221},
1946 {'3', 'c', 0x3222},
1947 {'4', 'c', 0x3223},
1948 {'5', 'c', 0x3224},
1949 {'6', 'c', 0x3225},
1950 {'7', 'c', 0x3226},
1951 {'8', 'c', 0x3227},
1952 {'9', 'c', 0x3228},
Bram Moolenaarceb45be2010-05-07 16:18:14 +02001953 /* code points 0xe000 - 0xefff excluded, they have no assigned
1954 * characters, only used in proposals. */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001955 {'f', 'f', 0xfb00},
1956 {'f', 'i', 0xfb01},
1957 {'f', 'l', 0xfb02},
1958 {'f', 't', 0xfb05},
1959 {'s', 't', 0xfb06},
1960# endif /* FEAT_MBYTE */
Bram Moolenaar5f91c0c2008-01-03 16:54:33 +00001961
Bram Moolenaar071d4272004-06-13 20:20:40 +00001962 {NUL, NUL, NUL}
1963 };
1964
Bram Moolenaar48e330a2016-02-23 14:53:34 +01001965# endif /* OLD_DIGRAPHS */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001966
Bram Moolenaar48e330a2016-02-23 14:53:34 +01001967# endif /* Macintosh */
1968# endif /* EBCDIC */
1969# endif /* !HPUX_DIGRAPHS */
1970#endif /* !__MINT__ */
Bram Moolenaar071d4272004-06-13 20:20:40 +00001971
1972/*
1973 * handle digraphs after typing a character
1974 */
1975 int
Bram Moolenaar7454a062016-01-30 15:14:10 +01001976do_digraph(int c)
Bram Moolenaar071d4272004-06-13 20:20:40 +00001977{
1978 static int backspaced; /* character before K_BS */
1979 static int lastchar; /* last typed character */
1980
1981 if (c == -1) /* init values */
1982 {
1983 backspaced = -1;
1984 }
1985 else if (p_dg)
1986 {
1987 if (backspaced >= 0)
1988 c = getdigraph(backspaced, c, FALSE);
1989 backspaced = -1;
1990 if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
1991 backspaced = lastchar;
1992 }
1993 lastchar = c;
1994 return c;
1995}
1996
1997/*
Bram Moolenaar5f73ef82018-02-27 21:09:30 +01001998 * Find a digraph for "val". If found return the string to display it.
1999 * If not found return NULL.
2000 */
2001 char_u *
Bram Moolenaarbc5020a2018-06-16 17:25:22 +02002002get_digraph_for_char(int val_arg)
Bram Moolenaar5f73ef82018-02-27 21:09:30 +01002003{
Bram Moolenaarbc5020a2018-06-16 17:25:22 +02002004 int val = val_arg;
Bram Moolenaar5f73ef82018-02-27 21:09:30 +01002005 int i;
2006 int use_defaults;
2007 digr_T *dp;
2008 static char_u r[3];
2009
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002010#if defined(USE_UNICODE_DIGRAPHS)
Bram Moolenaarbc5020a2018-06-16 17:25:22 +02002011 if (!enc_utf8)
2012 {
2013 char_u buf[6], *to;
2014 vimconv_T vc;
2015
2016 // convert the character from 'encoding' to Unicode
2017 i = mb_char2bytes(val, buf);
2018 vc.vc_type = CONV_NONE;
2019 if (convert_setup(&vc, p_enc, (char_u *)"utf-8") == OK)
2020 {
2021 vc.vc_fail = TRUE;
2022 to = string_convert(&vc, buf, &i);
2023 if (to != NULL)
2024 {
2025 val = utf_ptr2char(to);
2026 vim_free(to);
2027 }
2028 (void)convert_setup(&vc, NULL, NULL);
2029 }
2030 }
2031#endif
2032
Bram Moolenaar5f73ef82018-02-27 21:09:30 +01002033 for (use_defaults = 0; use_defaults <= 1; use_defaults++)
2034 {
2035 if (use_defaults == 0)
2036 dp = (digr_T *)user_digraphs.ga_data;
2037 else
2038 dp = digraphdefault;
2039 for (i = 0; use_defaults ? dp->char1 != NUL
2040 : i < user_digraphs.ga_len; ++i)
2041 {
2042 if (dp->result == val)
2043 {
2044 r[0] = dp->char1;
2045 r[1] = dp->char2;
2046 r[2] = NUL;
2047 return r;
2048 }
2049 ++dp;
2050 }
2051 }
2052 return NULL;
2053}
2054
2055/*
Bram Moolenaar071d4272004-06-13 20:20:40 +00002056 * Get a digraph. Used after typing CTRL-K on the command line or in normal
2057 * mode.
2058 * Returns composed character, or NUL when ESC was used.
2059 */
2060 int
Bram Moolenaar7454a062016-01-30 15:14:10 +01002061get_digraph(
2062 int cmdline) /* TRUE when called from the cmdline */
Bram Moolenaar071d4272004-06-13 20:20:40 +00002063{
2064 int c, cc;
2065
2066 ++no_mapping;
2067 ++allow_keys;
Bram Moolenaar61abfd12007-09-13 16:26:47 +00002068 c = plain_vgetc();
Bram Moolenaar071d4272004-06-13 20:20:40 +00002069 --no_mapping;
2070 --allow_keys;
2071 if (c != ESC) /* ESC cancels CTRL-K */
2072 {
2073 if (IS_SPECIAL(c)) /* insert special key code */
2074 return c;
2075 if (cmdline)
2076 {
2077 if (char2cells(c) == 1
2078#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
2079 && cmdline_star == 0
2080#endif
2081 )
2082 putcmdline(c, TRUE);
2083 }
2084#ifdef FEAT_CMDL_INFO
2085 else
2086 add_to_showcmd(c);
2087#endif
2088 ++no_mapping;
2089 ++allow_keys;
Bram Moolenaar61abfd12007-09-13 16:26:47 +00002090 cc = plain_vgetc();
Bram Moolenaar071d4272004-06-13 20:20:40 +00002091 --no_mapping;
2092 --allow_keys;
2093 if (cc != ESC) /* ESC cancels CTRL-K */
2094 return getdigraph(c, cc, TRUE);
2095 }
2096 return NUL;
2097}
2098
2099/*
2100 * Lookup the pair "char1", "char2" in the digraph tables.
2101 * If no match, return "char2".
Bram Moolenaar70b2a562012-01-10 22:26:17 +01002102 * If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002103 */
2104 static int
Bram Moolenaar7454a062016-01-30 15:14:10 +01002105getexactdigraph(int char1, int char2, int meta_char)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002106{
2107 int i;
2108 int retval = 0;
2109 digr_T *dp;
2110
2111 if (IS_SPECIAL(char1) || IS_SPECIAL(char2))
2112 return char2;
2113
2114 /*
2115 * Search user digraphs first.
2116 */
2117 dp = (digr_T *)user_digraphs.ga_data;
2118 for (i = 0; i < user_digraphs.ga_len; ++i)
2119 {
2120 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2121 {
2122 retval = dp->result;
2123 break;
2124 }
2125 ++dp;
2126 }
2127
2128 /*
2129 * Search default digraphs.
2130 */
2131 if (retval == 0)
2132 {
2133 dp = digraphdefault;
2134 for (i = 0; dp->char1 != 0; ++i)
2135 {
2136 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2137 {
2138 retval = dp->result;
2139 break;
2140 }
2141 ++dp;
2142 }
2143 }
2144#ifdef FEAT_MBYTE
2145# ifdef USE_UNICODE_DIGRAPHS
2146 if (retval != 0 && !enc_utf8)
2147 {
2148 char_u buf[6], *to;
2149 vimconv_T vc;
2150
2151 /*
2152 * Convert the Unicode digraph to 'encoding'.
2153 */
2154 i = utf_char2bytes(retval, buf);
2155 retval = 0;
2156 vc.vc_type = CONV_NONE;
2157 if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK)
2158 {
2159 vc.vc_fail = TRUE;
2160 to = string_convert(&vc, buf, &i);
2161 if (to != NULL)
2162 {
2163 retval = (*mb_ptr2char)(to);
2164 vim_free(to);
2165 }
2166 (void)convert_setup(&vc, NULL, NULL);
2167 }
2168 }
2169# endif
2170
2171 /* Ignore multi-byte characters when not in multi-byte mode. */
2172 if (!has_mbyte && retval > 0xff)
2173 retval = 0;
2174#endif
2175
2176 if (retval == 0) /* digraph deleted or not found */
2177 {
Bram Moolenaar70b2a562012-01-10 22:26:17 +01002178 if (char1 == ' ' && meta_char) /* <space> <char> --> meta-char */
Bram Moolenaar071d4272004-06-13 20:20:40 +00002179 return (char2 | 0x80);
2180 return char2;
2181 }
2182 return retval;
2183}
2184
2185/*
2186 * Get digraph.
2187 * Allow for both char1-char2 and char2-char1
2188 */
2189 int
Bram Moolenaar7454a062016-01-30 15:14:10 +01002190getdigraph(int char1, int char2, int meta_char)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002191{
2192 int retval;
2193
Bram Moolenaar70b2a562012-01-10 22:26:17 +01002194 if (((retval = getexactdigraph(char1, char2, meta_char)) == char2)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002195 && (char1 != char2)
Bram Moolenaar70b2a562012-01-10 22:26:17 +01002196 && ((retval = getexactdigraph(char2, char1, meta_char)) == char1))
Bram Moolenaar071d4272004-06-13 20:20:40 +00002197 return char2;
2198 return retval;
2199}
2200
2201/*
2202 * Add the digraphs in the argument to the digraph table.
2203 * format: {c1}{c2} char {c1}{c2} char ...
2204 */
2205 void
Bram Moolenaar7454a062016-01-30 15:14:10 +01002206putdigraph(char_u *str)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002207{
2208 int char1, char2, n;
2209 int i;
2210 digr_T *dp;
2211
2212 while (*str != NUL)
2213 {
2214 str = skipwhite(str);
2215 if (*str == NUL)
2216 return;
2217 char1 = *str++;
2218 char2 = *str++;
2219 if (char2 == 0)
2220 {
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002221 emsg(_(e_invarg));
Bram Moolenaar071d4272004-06-13 20:20:40 +00002222 return;
2223 }
2224 if (char1 == ESC || char2 == ESC)
2225 {
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002226 emsg(_("E104: Escape not allowed in digraph"));
Bram Moolenaar071d4272004-06-13 20:20:40 +00002227 return;
2228 }
2229 str = skipwhite(str);
2230 if (!VIM_ISDIGIT(*str))
2231 {
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002232 emsg(_(e_number_exp));
Bram Moolenaar071d4272004-06-13 20:20:40 +00002233 return;
2234 }
2235 n = getdigits(&str);
2236
2237 /* If the digraph already exists, replace the result. */
2238 dp = (digr_T *)user_digraphs.ga_data;
2239 for (i = 0; i < user_digraphs.ga_len; ++i)
2240 {
2241 if ((int)dp->char1 == char1 && (int)dp->char2 == char2)
2242 {
2243 dp->result = n;
2244 break;
2245 }
2246 ++dp;
2247 }
2248
2249 /* Add a new digraph to the table. */
2250 if (i == user_digraphs.ga_len)
2251 {
2252 if (ga_grow(&user_digraphs, 1) == OK)
2253 {
2254 dp = (digr_T *)user_digraphs.ga_data + user_digraphs.ga_len;
2255 dp->char1 = char1;
2256 dp->char2 = char2;
2257 dp->result = n;
2258 ++user_digraphs.ga_len;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002259 }
2260 }
2261 }
2262}
2263
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002264#if defined(USE_UNICODE_DIGRAPHS)
2265 static void
2266digraph_header(char *msg)
2267{
2268 if (msg_col > 0)
2269 msg_putchar('\n');
2270 msg_outtrans_attr((char_u *)msg, HL_ATTR(HLF_CM));
2271 msg_putchar('\n');
2272}
2273#endif
2274
Bram Moolenaar071d4272004-06-13 20:20:40 +00002275 void
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002276listdigraphs(int use_headers)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002277{
2278 int i;
2279 digr_T *dp;
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002280 result_T previous = 0;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002281
2282 msg_putchar('\n');
2283
2284 dp = digraphdefault;
2285 for (i = 0; dp->char1 != NUL && !got_int; ++i)
2286 {
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002287#if defined(USE_UNICODE_DIGRAPHS)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002288 digr_T tmp;
2289
2290 /* May need to convert the result to 'encoding'. */
2291 tmp.char1 = dp->char1;
2292 tmp.char2 = dp->char2;
2293 tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
2294 if (tmp.result != 0 && tmp.result != tmp.char2
2295 && (has_mbyte || tmp.result <= 255))
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002296 printdigraph(&tmp, use_headers ? &previous : NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002297#else
2298
2299 if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
2300# ifdef FEAT_MBYTE
2301 && (has_mbyte || dp->result <= 255)
2302# endif
2303 )
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002304 printdigraph(dp, use_headers ? &previous : NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002305#endif
2306 ++dp;
2307 ui_breakcheck();
2308 }
2309
2310 dp = (digr_T *)user_digraphs.ga_data;
2311 for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
2312 {
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002313#if defined(USE_UNICODE_DIGRAPHS)
2314 if (previous >= 0 && use_headers)
2315 digraph_header(_("Custom"));
2316 previous = -1;
2317#endif
2318 printdigraph(dp, NULL);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002319 ui_breakcheck();
2320 ++dp;
2321 }
2322 must_redraw = CLEAR; /* clear screen, because some digraphs may be
2323 wrong, in which case we messed up ScreenLines */
2324}
2325
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002326struct dg_header_entry {
2327 int dg_start;
2328 char *dg_header;
2329} header_table[] = {
2330 {DG_START_LATIN, N_("Latin supplement")},
2331 {DG_START_GREEK, N_("Greek and Coptic")},
2332 {DG_START_CYRILLIC, N_("Cyrillic")},
2333 {DG_START_HEBREW, N_("Hebrew")},
2334 {DG_START_ARABIC, N_("Arabic")},
2335 {DG_START_LATIN_EXTENDED, N_("Latin extended")},
2336 {DG_START_GREEK_EXTENDED, N_("Greek extended")},
2337 {DG_START_PUNCTUATION, N_("Punctuation")},
2338 {DG_START_SUB_SUPER, N_("Super- and subscripts")},
2339 {DG_START_CURRENCY, N_("Currency")},
2340 {DG_START_OTHER1, N_("Other")},
2341 {DG_START_ROMAN, N_("Roman numbers")},
2342 {DG_START_ARROWS, N_("Arrows")},
2343 {DG_START_MATH, N_("Mathematical operators")},
2344 {DG_START_TECHNICAL, N_("Technical")},
2345 {DG_START_OTHER2, N_("Other")},
2346 {DG_START_DRAWING, N_("Box drawing")},
2347 {DG_START_BLOCK, N_("Block elements")},
2348 {DG_START_SHAPES, N_("Geometric shapes")},
2349 {DG_START_SYMBOLS, N_("Symbols")},
2350 {DG_START_DINGBATS, N_("Dingbats")},
2351 {DG_START_CJK_SYMBOLS, N_("CJK symbols and punctuation")},
2352 {DG_START_HIRAGANA, N_("Hiragana")},
2353 {DG_START_KATAKANA, N_("Katakana")},
2354 {DG_START_BOPOMOFO, N_("Bopomofo")},
2355 {DG_START_OTHER3, N_("Other")},
2356 {0xfffffff, NULL},
2357};
2358
Bram Moolenaar071d4272004-06-13 20:20:40 +00002359 static void
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002360printdigraph(digr_T *dp, result_T *previous)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002361{
2362 char_u buf[30];
2363 char_u *p;
2364
2365 int list_width;
2366
2367 if ((dy_flags & DY_UHEX)
2368#ifdef FEAT_MBYTE
2369 || has_mbyte
2370#endif
2371 )
2372 list_width = 13;
2373 else
2374 list_width = 11;
2375
2376 if (dp->result != 0)
2377 {
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002378#if defined(USE_UNICODE_DIGRAPHS)
2379 if (previous != NULL)
2380 {
2381 int i;
2382
2383 for (i = 0; header_table[i].dg_header != NULL; ++i)
2384 if (*previous < header_table[i].dg_start
2385 && dp->result >= header_table[i].dg_start
2386 && dp->result < header_table[i + 1].dg_start)
2387 {
2388 digraph_header(_(header_table[i].dg_header));
2389 break;
2390 }
2391 *previous = dp->result;
2392 }
2393#endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00002394 if (msg_col > Columns - list_width)
2395 msg_putchar('\n');
2396 if (msg_col)
2397 while (msg_col % list_width != 0)
2398 msg_putchar(' ');
2399
2400 p = buf;
2401 *p++ = dp->char1;
2402 *p++ = dp->char2;
2403 *p++ = ' ';
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002404 *p = NUL;
2405 msg_outtrans(buf);
2406 p = buf;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002407#ifdef FEAT_MBYTE
2408 if (has_mbyte)
2409 {
2410 /* add a space to draw a composing char on */
2411 if (enc_utf8 && utf_iscomposing(dp->result))
2412 *p++ = ' ';
2413 p += (*mb_char2bytes)(dp->result, p);
2414 }
2415 else
2416#endif
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002417 *p++ = (char_u)dp->result;
Bram Moolenaareae8ae12018-12-14 18:53:02 +01002418 *p = NUL;
2419 msg_outtrans_attr(buf, HL_ATTR(HLF_8));
2420 p = buf;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002421 if (char2cells(dp->result) == 1)
2422 *p++ = ' ';
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002423 vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002424 msg_outtrans(buf);
2425 }
2426}
2427
2428#endif /* FEAT_DIGRAPHS */
2429
2430#if defined(FEAT_KEYMAP) || defined(PROTO)
2431
2432/* structure used for b_kmap_ga.ga_data */
2433typedef struct
2434{
2435 char_u *from;
2436 char_u *to;
2437} kmap_T;
2438
2439#define KMAP_MAXLEN 20 /* maximum length of "from" or "to" */
2440
Bram Moolenaarf28dbce2016-01-29 22:03:47 +01002441static void keymap_unload(void);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002442
2443/*
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002444 * Set up key mapping tables for the 'keymap' option.
2445 * Returns NULL if OK, an error message for failure. This only needs to be
2446 * used when setting the option, not later when the value has already been
2447 * checked.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002448 */
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002449 char *
Bram Moolenaar7454a062016-01-30 15:14:10 +01002450keymap_init(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002451{
2452 curbuf->b_kmap_state &= ~KEYMAP_INIT;
2453
2454 if (*curbuf->b_p_keymap == NUL)
2455 {
Bram Moolenaarbf444172007-07-07 11:58:28 +00002456 /* Stop any active keymap and clear the table. Also remove
Bram Moolenaar61abfd12007-09-13 16:26:47 +00002457 * b:keymap_name, as no keymap is active now. */
Bram Moolenaar071d4272004-06-13 20:20:40 +00002458 keymap_unload();
Bram Moolenaarbf444172007-07-07 11:58:28 +00002459 do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
Bram Moolenaar071d4272004-06-13 20:20:40 +00002460 }
2461 else
2462 {
2463 char_u *buf;
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002464 size_t buflen;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002465
2466 /* Source the keymap file. It will contain a ":loadkeymap" command
2467 * which will call ex_loadkeymap() below. */
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002468 buflen = STRLEN(curbuf->b_p_keymap)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002469# ifdef FEAT_MBYTE
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002470 + STRLEN(p_enc)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002471# endif
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002472 + 14;
2473 buf = alloc((unsigned)buflen);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002474 if (buf == NULL)
2475 return e_outofmem;
2476
2477# ifdef FEAT_MBYTE
2478 /* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002479 vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
2480 curbuf->b_p_keymap, p_enc);
Bram Moolenaar7f8989d2016-03-12 22:11:39 +01002481 if (source_runtime(buf, 0) == FAIL)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002482# endif
2483 {
2484 /* try finding "keymap/'keymap'.vim" in 'runtimepath' */
Bram Moolenaar0ab2a882009-05-13 10:51:08 +00002485 vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
2486 curbuf->b_p_keymap);
Bram Moolenaar7f8989d2016-03-12 22:11:39 +01002487 if (source_runtime(buf, 0) == FAIL)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002488 {
2489 vim_free(buf);
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002490 return N_("E544: Keymap file not found");
Bram Moolenaar071d4272004-06-13 20:20:40 +00002491 }
2492 }
2493 vim_free(buf);
2494 }
2495
2496 return NULL;
2497}
2498
2499/*
2500 * ":loadkeymap" command: load the following lines as the keymap.
2501 */
2502 void
Bram Moolenaar7454a062016-01-30 15:14:10 +01002503ex_loadkeymap(exarg_T *eap)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002504{
2505 char_u *line;
2506 char_u *p;
2507 char_u *s;
2508 kmap_T *kp;
2509#define KMAP_LLEN 200 /* max length of "to" and "from" together */
2510 char_u buf[KMAP_LLEN + 11];
2511 int i;
2512 char_u *save_cpo = p_cpo;
2513
2514 if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2515 {
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002516 emsg(_("E105: Using :loadkeymap not in a sourced file"));
Bram Moolenaar071d4272004-06-13 20:20:40 +00002517 return;
2518 }
2519
2520 /*
2521 * Stop any active keymap and clear the table.
2522 */
2523 keymap_unload();
2524
2525 curbuf->b_kmap_state = 0;
2526 ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
2527
2528 /* Set 'cpoptions' to "C" to avoid line continuation. */
2529 p_cpo = (char_u *)"C";
2530
2531 /*
2532 * Get each line of the sourced file, break at the end.
2533 */
2534 for (;;)
2535 {
2536 line = eap->getline(0, eap->cookie, 0);
2537 if (line == NULL)
2538 break;
2539
2540 p = skipwhite(line);
2541 if (*p != '"' && *p != NUL && ga_grow(&curbuf->b_kmap_ga, 1) == OK)
2542 {
2543 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len;
2544 s = skiptowhite(p);
2545 kp->from = vim_strnsave(p, (int)(s - p));
2546 p = skipwhite(s);
2547 s = skiptowhite(p);
2548 kp->to = vim_strnsave(p, (int)(s - p));
2549
2550 if (kp->from == NULL || kp->to == NULL
Bram Moolenaar57657d82006-04-21 22:12:41 +00002551 || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN
2552 || *kp->from == NUL || *kp->to == NUL)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002553 {
Bram Moolenaar57657d82006-04-21 22:12:41 +00002554 if (kp->to != NULL && *kp->to == NUL)
Bram Moolenaarf9e3e092019-01-13 23:38:42 +01002555 emsg(_("E791: Empty keymap entry"));
Bram Moolenaar071d4272004-06-13 20:20:40 +00002556 vim_free(kp->from);
2557 vim_free(kp->to);
2558 }
2559 else
Bram Moolenaar071d4272004-06-13 20:20:40 +00002560 ++curbuf->b_kmap_ga.ga_len;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002561 }
2562 vim_free(line);
2563 }
2564
2565 /*
2566 * setup ":lnoremap" to map the keys
2567 */
2568 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2569 {
Bram Moolenaar555b2802005-05-19 21:08:39 +00002570 vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s %s",
Bram Moolenaar071d4272004-06-13 20:20:40 +00002571 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from,
2572 ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to);
2573 (void)do_map(2, buf, LANGMAP, FALSE);
2574 }
2575
2576 p_cpo = save_cpo;
2577
2578 curbuf->b_kmap_state |= KEYMAP_LOADED;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002579 status_redraw_curbuf();
Bram Moolenaar071d4272004-06-13 20:20:40 +00002580}
2581
2582/*
2583 * Stop using 'keymap'.
2584 */
2585 static void
Bram Moolenaar7454a062016-01-30 15:14:10 +01002586keymap_unload(void)
Bram Moolenaar071d4272004-06-13 20:20:40 +00002587{
2588 char_u buf[KMAP_MAXLEN + 10];
2589 int i;
2590 char_u *save_cpo = p_cpo;
Bram Moolenaar8c8de832008-06-24 22:58:06 +00002591 kmap_T *kp;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002592
2593 if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
2594 return;
2595
2596 /* Set 'cpoptions' to "C" to avoid line continuation. */
2597 p_cpo = (char_u *)"C";
2598
2599 /* clear the ":lmap"s */
Bram Moolenaar8c8de832008-06-24 22:58:06 +00002600 kp = (kmap_T *)curbuf->b_kmap_ga.ga_data;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002601 for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
2602 {
Bram Moolenaar8c8de832008-06-24 22:58:06 +00002603 vim_snprintf((char *)buf, sizeof(buf), "<buffer> %s", kp[i].from);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002604 (void)do_map(1, buf, LANGMAP, FALSE);
2605 }
Bram Moolenaar50138322018-01-28 17:05:16 +01002606 keymap_clear(&curbuf->b_kmap_ga);
Bram Moolenaar071d4272004-06-13 20:20:40 +00002607
2608 p_cpo = save_cpo;
2609
2610 ga_clear(&curbuf->b_kmap_ga);
2611 curbuf->b_kmap_state &= ~KEYMAP_LOADED;
Bram Moolenaar071d4272004-06-13 20:20:40 +00002612 status_redraw_curbuf();
Bram Moolenaar071d4272004-06-13 20:20:40 +00002613}
2614
Bram Moolenaar50138322018-01-28 17:05:16 +01002615 void
2616keymap_clear(garray_T *kmap)
2617{
2618 int i;
2619 kmap_T *kp = (kmap_T *)kmap->ga_data;
2620
2621 for (i = 0; i < kmap->ga_len; ++i)
2622 {
2623 vim_free(kp[i].from);
2624 vim_free(kp[i].to);
2625 }
2626}
Bram Moolenaar071d4272004-06-13 20:20:40 +00002627#endif /* FEAT_KEYMAP */