xref: /freebsd/contrib/tcsh/ed.defns.c (revision 4f29da19bd44f0e99f021510460a81bf754c21d2)
1 /* $Header: /src/pub/tcsh/ed.defns.c,v 3.42 2005/03/03 16:49:15 kim Exp $ */
2 /*
3  * ed.defns.c: Editor function definitions and initialization
4  */
5 /*-
6  * Copyright (c) 1980, 1991 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 #include "sh.h"
34 
35 RCSID("$Id: ed.defns.c,v 3.42 2005/03/03 16:49:15 kim Exp $")
36 
37 #include "ed.h"
38 
39 static	void		ed_InitMetaBindings 	__P((void));
40 
41 PFCmd   CcFuncTbl[] = {		/* table of available commands */
42     e_unassigned,
43 /* no #define here -- this is a dummy to detect initing of the key map */
44     e_unassigned,
45 #define		F_UNASSIGNED	1
46     e_insert,
47 #define		F_INSERT	2
48     e_newline,
49 #define		F_NEWLINE	3
50     e_delprev,
51 #define		F_DELPREV	4
52     e_delnext,
53 #define		F_DELNEXT	5
54     e_toend,
55 #define		F_TOEND		6
56     e_tobeg,
57 #define		F_TOBEG		7
58     e_charback,
59 #define		F_CHARBACK	8
60     e_charfwd,
61 #define		F_CHARFWD	9
62     e_quote,
63 #define		F_QUOTE		10
64     e_startover,
65 #define		F_STARTOVER	11
66     e_redisp,
67 #define		F_REDISP	12
68     e_tty_int,
69 #define		F_TTY_INT	13
70     e_wordback,
71 #define		F_WORDBACK	14
72     e_wordfwd,
73 #define		F_WORDFWD	15
74     e_cleardisp,
75 #define		F_CLEARDISP	16
76     e_complete,
77 #define		F_COMPLETE	17
78     e_correct,
79 #define		F_CORRECT	18
80     e_up_hist,
81 #define		F_UP_HIST	19
82     e_down_hist,
83 #define		F_DOWN_HIST	20
84     e_up_search_hist,
85 #define		F_UP_SEARCH_HIST	21
86     e_down_search_hist,
87 #define		F_DOWN_SEARCH_HIST	22
88     e_helpme,
89 #define		F_HELPME	23
90     e_list_choices,
91 #define		F_LIST_CHOICES	24
92     e_delwordprev,
93 #define		F_DELWORDPREV	25
94     e_delwordnext,
95 #define		F_DELWORDNEXT	26
96     e_digit,
97 #define		F_DIGIT		27
98     e_killend,
99 #define		F_KILLEND	28
100     e_killbeg,
101 #define		F_KILLBEG	29
102     e_metanext,
103 #define		F_METANEXT	30
104     e_send_eof,
105 #define		F_SEND_EOF	31
106     e_charswitch,
107 #define		F_CHARSWITCH	32
108     e_which,
109 #define		F_WHICH		33
110     e_yank_kill,
111 #define		F_YANK_KILL	34
112     e_tty_dsusp,
113 #define		F_TTY_DSUSP	35
114     e_tty_flusho,
115 #define		F_TTY_FLUSHO	36
116     e_tty_quit,
117 #define		F_TTY_QUIT	37
118     e_tty_tsusp,
119 #define		F_TTY_TSUSP	38
120     e_tty_stopo,
121 #define		F_TTY_STOPO	39
122     e_tty_starto,
123 #define		F_TTY_STARTO	40
124     e_argfour,
125 #define		F_ARGFOUR	41
126     e_set_mark,
127 #define		F_SET_MARK	42
128     e_exchange_mark,
129 #define		F_EXCHANGE_MARK	43
130     e_last_item,
131 #define		F_LAST_ITEM	44
132     e_delnext_list_eof,
133 #define		F_DELNEXT_LIST_EOF	45
134     v_cmd_mode,
135 #define		V_CMD_MODE	46
136     v_insert,
137 #define		V_INSERT	47
138     e_argdigit,
139 #define		F_ARGDIGIT	48
140     e_killregion,
141 #define		F_KILLREGION	49
142     e_copyregion,
143 #define		F_COPYREGION	50
144     e_gcharswitch,
145 #define		F_GCHARSWITCH	51
146     e_run_fg_editor,
147 #define		F_RUN_FG_EDITOR	52
148     e_unassigned,	/* place holder for sequence lead in character */
149 #define		F_XKEY		53
150     e_uppercase,
151 #define         F_CASEUPPER     54
152     e_lowercase,
153 #define         F_CASELOWER     55
154     e_capitolcase,
155 #define         F_CASECAPITAL   56
156     v_zero,
157 #define		V_ZERO		57
158     v_add,
159 #define		V_ADD		58
160     v_addend,
161 #define		V_ADDEND	59
162     v_wordbegnext,
163 #define		V_WORDBEGNEXT	60
164     e_killall,
165 #define		F_KILLALL	61
166     e_unassigned,
167 /* F_EXTENDNEXT removed */
168     v_insbeg,
169 #define		V_INSBEG	63
170     v_replmode,
171 #define		V_REPLMODE	64
172     v_replone,
173 #define		V_REPLONE	65
174     v_substline,
175 #define		V_SUBSTLINE	66
176     v_substchar,
177 #define		V_SUBSTCHAR	67
178     v_chgtoend,
179 #define		V_CHGTOEND	68
180     e_list_eof,
181 #define		F_LIST_EOF	69
182     e_list_glob,
183 #define		F_LIST_GLOB	70
184     e_expand_history,
185 #define		F_EXPAND_HISTORY	71
186     e_magic_space,
187 #define		F_MAGIC_SPACE	72
188     e_insovr,
189 #define		F_INSOVR	73
190     v_cm_complete,
191 #define		V_CM_COMPLETE	74
192     e_copyprev,
193 #define		F_COPYPREV	75
194     e_correctl,
195 #define		F_CORRECT_L	76
196     e_expand_glob,
197 #define		F_EXPAND_GLOB	77
198     e_expand_vars,
199 #define		F_EXPAND_VARS	78
200     e_toggle_hist,
201 #define		F_TOGGLE_HIST	79
202     v_change_case,
203 #define		V_CHGCASE	80
204     e_expand,
205 #define		F_EXPAND	81
206     e_load_average,
207 #define		F_LOAD_AVERAGE	82
208     v_delprev,
209 #define		V_DELPREV	83
210     v_delmeta,
211 #define		V_DELMETA	84
212     v_wordfwd,
213 #define		V_WORDFWD	85
214     v_wordback,
215 #define		V_WORDBACK	86
216     v_endword,
217 #define		V_ENDWORD	87
218     v_eword,
219 #define		V_EWORD		88
220     v_undo,
221 #define		V_UNDO		89
222     v_ush_meta,
223 #define		V_USH_META	90
224     v_dsh_meta,
225 #define		V_DSH_META	91
226     v_rsrch_fwd,
227 #define		V_RSRCH_FWD	92
228     v_rsrch_back,
229 #define		V_RSRCH_BACK	93
230     v_char_fwd,
231 #define		V_CHAR_FWD	94
232     v_char_back,
233 #define		V_CHAR_BACK	95
234     v_chgmeta,
235 #define		V_CHGMETA	96
236     e_inc_fwd,
237 #define		F_INC_FWD	97
238     e_inc_back,
239 #define		F_INC_BACK	98
240     v_rchar_fwd,
241 #define		V_RCHAR_FWD	99
242     v_rchar_back,
243 #define		V_RCHAR_BACK	100
244     v_charto_fwd,
245 #define		V_CHARTO_FWD	101
246     v_charto_back,
247 #define		V_CHARTO_BACK	102
248     e_normalize_path,
249 #define		F_PATH_NORM	103
250     e_delnext_eof,		/* added by mtk@ari.ncl.omron.co.jp (920818) */
251 #define		F_DELNEXT_EOF	104
252     e_stuff_char,
253 #define		F_STUFF_CHAR	105
254     e_complete_all,
255 #define		F_COMPLETE_ALL	106
256     e_list_all,
257 #define		F_LIST_ALL	107
258     e_complete_fwd,
259 #define		F_COMPLETE_FWD	108
260     e_complete_back,
261 #define		F_COMPLETE_BACK	109
262     e_delnext_list,
263 #define		F_DELNEXT_LIST	110
264     e_normalize_command,
265 #define		F_COMMAND_NORM	111
266     e_dabbrev_expand,
267 #define		F_DABBREV_EXPAND	112
268     e_copy_to_clipboard,
269 #define		F_COPY_CLIP	113
270     e_paste_from_clipboard,
271 #define		F_PASTE_CLIP	114
272     e_dosify_next,
273 #define		F_DOSIFY_NEXT	115
274     e_dosify_prev,
275 #define		F_DOSIFY_PREV	116
276     e_page_up,
277 #define		F_PAGE_UP	117
278     e_page_down,
279 #define		F_PAGE_DOWN	118
280     e_yank_pop,
281 #define		F_YANK_POP	119
282     0				/* DUMMY VALUE */
283 #define		F_NUM_FNS	120
284 
285 };
286 
287 KEYCMD  NumFuns = F_NUM_FNS;
288 
289 KEYCMD  CcKeyMap[NT_NUM_KEYS];		/* the real key map */
290 KEYCMD  CcAltMap[NT_NUM_KEYS];		/* the alternative key map */
291 #define	F_NUM_FUNCNAMES	(F_NUM_FNS + 2)
292 struct KeyFuncs FuncNames[F_NUM_FUNCNAMES];
293 
294 #ifdef WINNT_NATIVE
295 extern KEYCMD CcEmacsMap[];
296 extern KEYCMD CcViMap[];
297 extern KEYCMD  CcViCmdMap[];
298 #else /* !WINNT_NATIVE*/
299 KEYCMD  CcEmacsMap[] = {
300 /* keymap table, each index into above tbl; should be 256*sizeof(KEYCMD)
301    bytes long */
302 
303     F_SET_MARK,			/* ^@ */
304     F_TOBEG,			/* ^A */
305     F_CHARBACK,			/* ^B */
306     F_TTY_INT,			/* ^C */
307     F_DELNEXT_LIST_EOF,		/* ^D */
308     F_TOEND,			/* ^E */
309     F_CHARFWD,			/* ^F */
310     F_UNASSIGNED,		/* ^G */
311     F_DELPREV,			/* ^H */
312     F_COMPLETE,			/* ^I */
313     F_NEWLINE,			/* ^J */
314     F_KILLEND,			/* ^K */
315     F_CLEARDISP,		/* ^L */
316     F_NEWLINE,			/* ^M */
317     F_DOWN_HIST,		/* ^N */
318     F_TTY_FLUSHO,		/* ^O */
319     F_UP_HIST,			/* ^P */
320     F_TTY_STARTO,		/* ^Q */
321     F_REDISP,			/* ^R */
322     F_TTY_STOPO,		/* ^S */
323     F_CHARSWITCH,		/* ^T */
324     F_KILLALL,			/* ^U */
325     F_QUOTE,			/* ^V */
326     F_KILLREGION,		/* ^W */
327     F_XKEY,			/* ^X */
328     F_YANK_KILL,		/* ^Y */
329     F_TTY_TSUSP,		/* ^Z */
330     F_METANEXT,			/* ^[ */
331     F_TTY_QUIT,			/* ^\ */
332     F_TTY_DSUSP,		/* ^] */
333     F_UNASSIGNED,		/* ^^ */
334     F_UNASSIGNED,		/* ^_ */
335     F_INSERT,			/* SPACE */
336     F_INSERT,			/* ! */
337     F_INSERT,			/* " */
338     F_INSERT,			/* # */
339     F_INSERT,			/* $ */
340     F_INSERT,			/* % */
341     F_INSERT,			/* & */
342     F_INSERT,			/* ' */
343     F_INSERT,			/* ( */
344     F_INSERT,			/* ) */
345     F_INSERT,			/* * */
346     F_INSERT,			/* + */
347     F_INSERT,			/* , */
348     F_INSERT,			/* - */
349     F_INSERT,			/* . */
350     F_INSERT,			/* / */
351     F_DIGIT,			/* 0 */
352     F_DIGIT,			/* 1 */
353     F_DIGIT,			/* 2 */
354     F_DIGIT,			/* 3 */
355     F_DIGIT,			/* 4 */
356     F_DIGIT,			/* 5 */
357     F_DIGIT,			/* 6 */
358     F_DIGIT,			/* 7 */
359     F_DIGIT,			/* 8 */
360     F_DIGIT,			/* 9 */
361     F_INSERT,			/* : */
362     F_INSERT,			/* ; */
363     F_INSERT,			/* < */
364     F_INSERT,			/* = */
365     F_INSERT,			/* > */
366     F_INSERT,			/* ? */
367     F_INSERT,			/* @ */
368     F_INSERT,			/* A */
369     F_INSERT,			/* B */
370     F_INSERT,			/* C */
371     F_INSERT,			/* D */
372     F_INSERT,			/* E */
373     F_INSERT,			/* F */
374     F_INSERT,			/* G */
375     F_INSERT,			/* H */
376     F_INSERT,			/* I */
377     F_INSERT,			/* J */
378     F_INSERT,			/* K */
379     F_INSERT,			/* L */
380     F_INSERT,			/* M */
381     F_INSERT,			/* N */
382     F_INSERT,			/* O */
383     F_INSERT,			/* P */
384     F_INSERT,			/* Q */
385     F_INSERT,			/* R */
386     F_INSERT,			/* S */
387     F_INSERT,			/* T */
388     F_INSERT,			/* U */
389     F_INSERT,			/* V */
390     F_INSERT,			/* W */
391     F_INSERT,			/* X */
392     F_INSERT,			/* Y */
393     F_INSERT,			/* Z */
394     F_INSERT,			/* [ */
395     F_INSERT,			/* \ */
396     F_INSERT,			/* ] */
397     F_INSERT,			/* ^ */
398     F_INSERT,			/* _ */
399     F_INSERT,			/* ` */
400     F_INSERT,			/* a */
401     F_INSERT,			/* b */
402     F_INSERT,			/* c */
403     F_INSERT,			/* d */
404     F_INSERT,			/* e */
405     F_INSERT,			/* f */
406     F_INSERT,			/* g */
407     F_INSERT,			/* h */
408     F_INSERT,			/* i */
409     F_INSERT,			/* j */
410     F_INSERT,			/* k */
411     F_INSERT,			/* l */
412     F_INSERT,			/* m */
413     F_INSERT,			/* n */
414     F_INSERT,			/* o */
415     F_INSERT,			/* p */
416     F_INSERT,			/* q */
417     F_INSERT,			/* r */
418     F_INSERT,			/* s */
419     F_INSERT,			/* t */
420     F_INSERT,			/* u */
421     F_INSERT,			/* v */
422     F_INSERT,			/* w */
423     F_INSERT,			/* x */
424     F_INSERT,			/* y */
425     F_INSERT,			/* z */
426     F_INSERT,			/* { */
427     F_INSERT,			/* | */
428     F_INSERT,			/* } */
429     F_INSERT,			/* ~ */
430     F_DELPREV,			/* ^? */
431     F_UNASSIGNED,		/* M-^@ */
432     F_UNASSIGNED,		/* M-^A */
433     F_UNASSIGNED,		/* M-^B */
434     F_UNASSIGNED,		/* M-^C */
435     F_LIST_CHOICES,		/* M-^D */
436     F_UNASSIGNED,		/* M-^E */
437     F_UNASSIGNED,		/* M-^F */
438     F_UNASSIGNED,		/* M-^G */
439     F_DELWORDPREV,		/* M-^H */
440     F_COMPLETE,			/* M-^I */
441     F_UNASSIGNED,		/* M-^J */
442     F_UNASSIGNED,		/* M-^K */
443     F_CLEARDISP,		/* M-^L */
444     F_UNASSIGNED,		/* M-^M */
445     F_UNASSIGNED,		/* M-^N */
446     F_UNASSIGNED,		/* M-^O */
447     F_UNASSIGNED,		/* M-^P */
448     F_UNASSIGNED,		/* M-^Q */
449     F_UNASSIGNED,		/* M-^R */
450     F_UNASSIGNED,		/* M-^S */
451     F_UNASSIGNED,		/* M-^T */
452     F_UNASSIGNED,		/* M-^U */
453     F_UNASSIGNED,		/* M-^V */
454     F_UNASSIGNED,		/* M-^W */
455     F_UNASSIGNED,		/* M-^X */
456     F_UNASSIGNED,		/* M-^Y */
457     F_RUN_FG_EDITOR,		/* M-^Z */
458     F_COMPLETE,			/* M-^[ */
459     F_UNASSIGNED,		/* M-^\ */
460     F_UNASSIGNED,		/* M-^] */
461     F_UNASSIGNED,		/* M-^^ */
462     F_COPYPREV,			/* M-^_ */
463     F_EXPAND_HISTORY,		/* M-SPACE */
464     F_EXPAND_HISTORY,		/* M-! */
465     F_UNASSIGNED,		/* M-" */
466     F_UNASSIGNED,		/* M-# */
467     F_CORRECT_L,		/* M-$ */
468     F_UNASSIGNED,		/* M-% */
469     F_UNASSIGNED,		/* M-& */
470     F_UNASSIGNED,		/* M-' */
471     F_UNASSIGNED,		/* M-( */
472     F_UNASSIGNED,		/* M-) */
473     F_UNASSIGNED,		/* M-* */
474     F_UNASSIGNED,		/* M-+ */
475     F_UNASSIGNED,		/* M-, */
476     F_UNASSIGNED,		/* M-- */
477     F_UNASSIGNED,		/* M-. */
478     F_DABBREV_EXPAND,		/* M-/ */
479     F_ARGDIGIT,			/* M-0 */
480     F_ARGDIGIT,			/* M-1 */
481     F_ARGDIGIT,			/* M-2 */
482     F_ARGDIGIT,			/* M-3 */
483     F_ARGDIGIT,			/* M-4 */
484     F_ARGDIGIT,			/* M-5 */
485     F_ARGDIGIT,			/* M-6 */
486     F_ARGDIGIT,			/* M-7 */
487     F_ARGDIGIT,			/* M-8 */
488     F_ARGDIGIT,			/* M-9 */
489     F_UNASSIGNED,		/* M-: */
490     F_UNASSIGNED,		/* M-; */
491     F_UNASSIGNED,		/* M-< */
492     F_UNASSIGNED,		/* M-= */
493     F_UNASSIGNED,		/* M-> */
494     F_WHICH,			/* M-? */
495     F_UNASSIGNED,		/* M-@ */
496     F_UNASSIGNED,		/* M-A */
497     F_WORDBACK,			/* M-B */
498     F_CASECAPITAL,		/* M-C */
499     F_DELWORDNEXT,		/* M-D */
500     F_UNASSIGNED,		/* M-E */
501     F_WORDFWD,			/* M-F */
502     F_UNASSIGNED,		/* M-G */
503     F_HELPME,			/* M-H */
504     F_UNASSIGNED,		/* M-I */
505     F_UNASSIGNED,		/* M-J */
506     F_UNASSIGNED,		/* M-K */
507     F_CASELOWER,		/* M-L */
508     F_UNASSIGNED,		/* M-M */
509     F_DOWN_SEARCH_HIST,		/* M-N */
510     F_XKEY,			/* M-O *//* extended key esc PWP Mar 88 */
511     F_UP_SEARCH_HIST,		/* M-P */
512     F_UNASSIGNED,		/* M-Q */
513     F_TOGGLE_HIST,		/* M-R */
514     F_CORRECT,			/* M-S */
515     F_UNASSIGNED,		/* M-T */
516     F_CASEUPPER,		/* M-U */
517     F_UNASSIGNED,		/* M-V */
518     F_COPYREGION,		/* M-W */
519     F_UNASSIGNED,		/* M-X */
520     F_YANK_POP,			/* M-Y */
521     F_UNASSIGNED,		/* M-Z */
522     F_XKEY,			/* M-[ *//* extended key esc -mf Oct 87 */
523     F_UNASSIGNED,		/* M-\ */
524     F_UNASSIGNED,		/* M-] */
525     F_UNASSIGNED,		/* M-^ */
526     F_LAST_ITEM,		/* M-_ */
527     F_UNASSIGNED,		/* M-` */
528     F_UNASSIGNED,		/* M-a */
529     F_WORDBACK,			/* M-b */
530     F_CASECAPITAL,		/* M-c */
531     F_DELWORDNEXT,		/* M-d */
532     F_UNASSIGNED,		/* M-e */
533     F_WORDFWD,			/* M-f */
534     F_UNASSIGNED,		/* M-g */
535     F_HELPME,			/* M-h */
536     F_UNASSIGNED,		/* M-i */
537     F_UNASSIGNED,		/* M-j */
538     F_UNASSIGNED,		/* M-k */
539     F_CASELOWER,		/* M-l */
540     F_UNASSIGNED,		/* M-m */
541     F_DOWN_SEARCH_HIST,		/* M-n */
542     F_UNASSIGNED,		/* M-o */
543     F_UP_SEARCH_HIST,		/* M-p */
544     F_UNASSIGNED,		/* M-q */
545     F_TOGGLE_HIST,		/* M-r */
546     F_CORRECT,			/* M-s */
547     F_UNASSIGNED,		/* M-t */
548     F_CASEUPPER,		/* M-u */
549     F_UNASSIGNED,		/* M-v */
550     F_COPYREGION,		/* M-w */
551     F_UNASSIGNED,		/* M-x */
552     F_YANK_POP,			/* M-y */
553     F_UNASSIGNED,		/* M-z */
554     F_UNASSIGNED,		/* M-{ */
555     F_UNASSIGNED,		/* M-| */
556     F_UNASSIGNED,		/* M-} */
557     F_UNASSIGNED,		/* M-~ */
558     F_DELWORDPREV		/* M-^? */
559 };
560 
561 /*
562  * keymap table for vi.  Each index into above tbl; should be
563  * 256 entries long.  Vi mode uses a sticky-extend to do command mode:
564  * insert mode characters are in the normal keymap, and command mode
565  * in the extended keymap.
566  */
567 static KEYCMD  CcViMap[] = {
568 #ifdef KSHVI
569     F_UNASSIGNED,		/* ^@ */
570     F_INSERT,			/* ^A */
571     F_INSERT,			/* ^B */
572     F_INSERT,			/* ^C */
573     F_INSERT,			/* ^D */
574     F_INSERT,			/* ^E */
575     F_INSERT,			/* ^F */
576     F_INSERT,			/* ^G */
577     V_DELPREV,			/* ^H */   /* BackSpace key */
578     F_COMPLETE,			/* ^I */   /* Tab Key  */
579     F_NEWLINE,			/* ^J */
580     F_INSERT,			/* ^K */
581     F_INSERT,			/* ^L */
582     F_NEWLINE,			/* ^M */
583     F_INSERT,			/* ^N */
584     F_INSERT,			/* ^O */
585     F_INSERT,			/* ^P */
586     F_TTY_STARTO,		/* ^Q */
587     F_INSERT,			/* ^R */
588     F_INSERT,			/* ^S */
589     F_INSERT,			/* ^T */
590     F_INSERT,			/* ^U */
591     F_QUOTE,			/* ^V */
592     F_DELWORDPREV,		/* ^W */  /* Only until start edit pos */
593     F_INSERT,			/* ^X */
594     F_INSERT,			/* ^Y */
595     F_INSERT,			/* ^Z */
596     V_CMD_MODE,			/* ^[ */  /* [ Esc ] key */
597     F_TTY_QUIT,			/* ^\ */
598     F_INSERT,			/* ^] */
599     F_INSERT,			/* ^^ */
600     F_INSERT,			/* ^_ */
601 #else /* !KSHVI */
602     F_UNASSIGNED,		/* ^@ */   /* NOTE: These mapping do NOT */
603     F_TOBEG,			/* ^A */   /* Correspond well to the KSH */
604     F_CHARBACK,			/* ^B */   /* VI editting assignments    */
605     F_TTY_INT,			/* ^C */   /* On the other hand they are */
606     F_LIST_EOF,			/* ^D */   /* convenient any many people */
607     F_TOEND,			/* ^E */   /* have gotten used to them   */
608     F_CHARFWD,			/* ^F */
609     F_LIST_GLOB,		/* ^G */
610     F_DELPREV,			/* ^H */   /* BackSpace key */
611     F_COMPLETE,			/* ^I */   /* Tab Key */
612     F_NEWLINE,			/* ^J */
613     F_KILLEND,			/* ^K */
614     F_CLEARDISP,		/* ^L */
615     F_NEWLINE,			/* ^M */
616     F_DOWN_HIST,		/* ^N */
617     F_TTY_FLUSHO,		/* ^O */
618     F_UP_HIST,			/* ^P */
619     F_TTY_STARTO,		/* ^Q */
620     F_REDISP,			/* ^R */
621     F_TTY_STOPO,		/* ^S */
622     F_CHARSWITCH,		/* ^T */
623     F_KILLBEG,			/* ^U */
624     F_QUOTE,			/* ^V */
625     F_DELWORDPREV,		/* ^W */
626     F_EXPAND,			/* ^X */
627     F_TTY_DSUSP,		/* ^Y */
628     F_TTY_TSUSP,		/* ^Z */
629     V_CMD_MODE,			/* ^[ */
630     F_TTY_QUIT,			/* ^\ */
631     F_UNASSIGNED,		/* ^] */
632     F_UNASSIGNED,		/* ^^ */
633     F_UNASSIGNED,		/* ^_ */
634 #endif  /* KSHVI */
635     F_INSERT,			/* SPACE */
636     F_INSERT,			/* ! */
637     F_INSERT,			/* " */
638     F_INSERT,			/* # */
639     F_INSERT,			/* $ */
640     F_INSERT,			/* % */
641     F_INSERT,			/* & */
642     F_INSERT,			/* ' */
643     F_INSERT,			/* ( */
644     F_INSERT,			/* ) */
645     F_INSERT,			/* * */
646     F_INSERT,			/* + */
647     F_INSERT,			/* , */
648     F_INSERT,			/* - */
649     F_INSERT,			/* . */
650     F_INSERT,			/* / */
651     F_INSERT,			/* 0 */
652     F_INSERT,			/* 1 */
653     F_INSERT,			/* 2 */
654     F_INSERT,			/* 3 */
655     F_INSERT,			/* 4 */
656     F_INSERT,			/* 5 */
657     F_INSERT,			/* 6 */
658     F_INSERT,			/* 7 */
659     F_INSERT,			/* 8 */
660     F_INSERT,			/* 9 */
661     F_INSERT,			/* : */
662     F_INSERT,			/* ; */
663     F_INSERT,			/* < */
664     F_INSERT,			/* = */
665     F_INSERT,			/* > */
666     F_INSERT,			/* ? */
667     F_INSERT,			/* @ */
668     F_INSERT,			/* A */
669     F_INSERT,			/* B */
670     F_INSERT,			/* C */
671     F_INSERT,			/* D */
672     F_INSERT,			/* E */
673     F_INSERT,			/* F */
674     F_INSERT,			/* G */
675     F_INSERT,			/* H */
676     F_INSERT,			/* I */
677     F_INSERT,			/* J */
678     F_INSERT,			/* K */
679     F_INSERT,			/* L */
680     F_INSERT,			/* M */
681     F_INSERT,			/* N */
682     F_INSERT,			/* O */
683     F_INSERT,			/* P */
684     F_INSERT,			/* Q */
685     F_INSERT,			/* R */
686     F_INSERT,			/* S */
687     F_INSERT,			/* T */
688     F_INSERT,			/* U */
689     F_INSERT,			/* V */
690     F_INSERT,			/* W */
691     F_INSERT,			/* X */
692     F_INSERT,			/* Y */
693     F_INSERT,			/* Z */
694     F_INSERT,			/* [ */
695     F_INSERT,			/* \ */
696     F_INSERT,			/* ] */
697     F_INSERT,			/* ^ */
698     F_INSERT,			/* _ */
699     F_INSERT,			/* ` */
700     F_INSERT,			/* a */
701     F_INSERT,			/* b */
702     F_INSERT,			/* c */
703     F_INSERT,			/* d */
704     F_INSERT,			/* e */
705     F_INSERT,			/* f */
706     F_INSERT,			/* g */
707     F_INSERT,			/* h */
708     F_INSERT,			/* i */
709     F_INSERT,			/* j */
710     F_INSERT,			/* k */
711     F_INSERT,			/* l */
712     F_INSERT,			/* m */
713     F_INSERT,			/* n */
714     F_INSERT,			/* o */
715     F_INSERT,			/* p */
716     F_INSERT,			/* q */
717     F_INSERT,			/* r */
718     F_INSERT,			/* s */
719     F_INSERT,			/* t */
720     F_INSERT,			/* u */
721     F_INSERT,			/* v */
722     F_INSERT,			/* w */
723     F_INSERT,			/* x */
724     F_INSERT,			/* y */
725     F_INSERT,			/* z */
726     F_INSERT,			/* { */
727     F_INSERT,			/* | */
728     F_INSERT,			/* } */
729     F_INSERT,			/* ~ */
730     F_DELPREV,			/* ^? */
731     F_UNASSIGNED,		/* M-^@ */
732     F_UNASSIGNED,		/* M-^A */
733     F_UNASSIGNED,		/* M-^B */
734     F_UNASSIGNED,		/* M-^C */
735     F_UNASSIGNED,		/* M-^D */
736     F_UNASSIGNED,		/* M-^E */
737     F_UNASSIGNED,		/* M-^F */
738     F_UNASSIGNED,		/* M-^G */
739     F_UNASSIGNED,		/* M-^H */
740     F_UNASSIGNED,		/* M-^I */
741     F_UNASSIGNED,		/* M-^J */
742     F_UNASSIGNED,		/* M-^K */
743     F_UNASSIGNED,		/* M-^L */
744     F_UNASSIGNED,		/* M-^M */
745     F_UNASSIGNED,		/* M-^N */
746     F_UNASSIGNED,		/* M-^O */
747     F_UNASSIGNED,		/* M-^P */
748     F_UNASSIGNED,		/* M-^Q */
749     F_UNASSIGNED,		/* M-^R */
750     F_UNASSIGNED,		/* M-^S */
751     F_UNASSIGNED,		/* M-^T */
752     F_UNASSIGNED,		/* M-^U */
753     F_UNASSIGNED,		/* M-^V */
754     F_UNASSIGNED,		/* M-^W */
755     F_UNASSIGNED,		/* M-^X */
756     F_UNASSIGNED,		/* M-^Y */
757     F_UNASSIGNED,		/* M-^Z */
758     F_UNASSIGNED,		/* M-^[ */
759     F_UNASSIGNED,		/* M-^\ */
760     F_UNASSIGNED,		/* M-^] */
761     F_UNASSIGNED,		/* M-^^ */
762     F_UNASSIGNED,		/* M-^_ */
763     F_UNASSIGNED,		/* M-SPACE */
764     F_UNASSIGNED,		/* M-! */
765     F_UNASSIGNED,		/* M-" */
766     F_UNASSIGNED,		/* M-# */
767     F_UNASSIGNED,		/* M-$ */
768     F_UNASSIGNED,		/* M-% */
769     F_UNASSIGNED,		/* M-& */
770     F_UNASSIGNED,		/* M-' */
771     F_UNASSIGNED,		/* M-( */
772     F_UNASSIGNED,		/* M-) */
773     F_UNASSIGNED,		/* M-* */
774     F_UNASSIGNED,		/* M-+ */
775     F_UNASSIGNED,		/* M-, */
776     F_UNASSIGNED,		/* M-- */
777     F_UNASSIGNED,		/* M-. */
778     F_UNASSIGNED,		/* M-/ */
779     F_UNASSIGNED,		/* M-0 */
780     F_UNASSIGNED,		/* M-1 */
781     F_UNASSIGNED,		/* M-2 */
782     F_UNASSIGNED,		/* M-3 */
783     F_UNASSIGNED,		/* M-4 */
784     F_UNASSIGNED,		/* M-5 */
785     F_UNASSIGNED,		/* M-6 */
786     F_UNASSIGNED,		/* M-7 */
787     F_UNASSIGNED,		/* M-8 */
788     F_UNASSIGNED,		/* M-9 */
789     F_UNASSIGNED,		/* M-: */
790     F_UNASSIGNED,		/* M-; */
791     F_UNASSIGNED,		/* M-< */
792     F_UNASSIGNED,		/* M-= */
793     F_UNASSIGNED,		/* M-> */
794     F_UNASSIGNED,		/* M-? */
795     F_UNASSIGNED,		/* M-@ */
796     F_UNASSIGNED,		/* M-A */
797     F_UNASSIGNED,		/* M-B */
798     F_UNASSIGNED,		/* M-C */
799     F_UNASSIGNED,		/* M-D */
800     F_UNASSIGNED,		/* M-E */
801     F_UNASSIGNED,		/* M-F */
802     F_UNASSIGNED,		/* M-G */
803     F_UNASSIGNED,		/* M-H */
804     F_UNASSIGNED,		/* M-I */
805     F_UNASSIGNED,		/* M-J */
806     F_UNASSIGNED,		/* M-K */
807     F_UNASSIGNED,		/* M-L */
808     F_UNASSIGNED,		/* M-M */
809     F_UNASSIGNED,		/* M-N */
810     F_UNASSIGNED,		/* M-O */
811     F_UNASSIGNED,		/* M-P */
812     F_UNASSIGNED,		/* M-Q */
813     F_UNASSIGNED,		/* M-R */
814     F_UNASSIGNED,		/* M-S */
815     F_UNASSIGNED,		/* M-T */
816     F_UNASSIGNED,		/* M-U */
817     F_UNASSIGNED,		/* M-V */
818     F_UNASSIGNED,		/* M-W */
819     F_UNASSIGNED,		/* M-X */
820     F_UNASSIGNED,		/* M-Y */
821     F_UNASSIGNED,		/* M-Z */
822     F_UNASSIGNED,		/* M-[ */
823     F_UNASSIGNED,		/* M-\ */
824     F_UNASSIGNED,		/* M-] */
825     F_UNASSIGNED,		/* M-^ */
826     F_UNASSIGNED,		/* M-_ */
827     F_UNASSIGNED,		/* M-` */
828     F_UNASSIGNED,		/* M-a */
829     F_UNASSIGNED,		/* M-b */
830     F_UNASSIGNED,		/* M-c */
831     F_UNASSIGNED,		/* M-d */
832     F_UNASSIGNED,		/* M-e */
833     F_UNASSIGNED,		/* M-f */
834     F_UNASSIGNED,		/* M-g */
835     F_UNASSIGNED,		/* M-h */
836     F_UNASSIGNED,		/* M-i */
837     F_UNASSIGNED,		/* M-j */
838     F_UNASSIGNED,		/* M-k */
839     F_UNASSIGNED,		/* M-l */
840     F_UNASSIGNED,		/* M-m */
841     F_UNASSIGNED,		/* M-n */
842     F_UNASSIGNED,		/* M-o */
843     F_UNASSIGNED,		/* M-p */
844     F_UNASSIGNED,		/* M-q */
845     F_UNASSIGNED,		/* M-r */
846     F_UNASSIGNED,		/* M-s */
847     F_UNASSIGNED,		/* M-t */
848     F_UNASSIGNED,		/* M-u */
849     F_UNASSIGNED,		/* M-v */
850     F_UNASSIGNED,		/* M-w */
851     F_UNASSIGNED,		/* M-x */
852     F_UNASSIGNED,		/* M-y */
853     F_UNASSIGNED,		/* M-z */
854     F_UNASSIGNED,		/* M-{ */
855     F_UNASSIGNED,		/* M-| */
856     F_UNASSIGNED,		/* M-} */
857     F_UNASSIGNED,		/* M-~ */
858     F_UNASSIGNED		/* M-^? */
859 };
860 
861 KEYCMD  CcViCmdMap[] = {
862     F_UNASSIGNED,		/* ^@ */
863     F_TOBEG,			/* ^A */
864     F_UNASSIGNED,		/* ^B */
865     F_TTY_INT,			/* ^C */
866     F_LIST_CHOICES,		/* ^D */
867     F_TOEND,			/* ^E */
868     F_UNASSIGNED,		/* ^F */
869     F_LIST_GLOB,		/* ^G */
870     F_CHARBACK,			/* ^H */
871     V_CM_COMPLETE,		/* ^I */
872     F_NEWLINE,			/* ^J */
873     F_KILLEND,			/* ^K */
874     F_CLEARDISP,		/* ^L */
875     F_NEWLINE,			/* ^M */
876     F_DOWN_HIST,		/* ^N */
877     F_TTY_FLUSHO,		/* ^O */
878     F_UP_HIST,			/* ^P */
879     F_TTY_STARTO,		/* ^Q */
880     F_REDISP,			/* ^R */
881     F_TTY_STOPO,		/* ^S */
882     F_UNASSIGNED,		/* ^T */
883     F_KILLBEG,			/* ^U */
884     F_UNASSIGNED,		/* ^V */
885     F_DELWORDPREV,		/* ^W */
886     F_EXPAND,			/* ^X */
887     F_UNASSIGNED,		/* ^Y */
888     F_UNASSIGNED,		/* ^Z */
889     F_METANEXT,			/* ^[ */
890     F_TTY_QUIT,			/* ^\ */
891     F_UNASSIGNED,		/* ^] */
892     F_UNASSIGNED,		/* ^^ */
893     F_UNASSIGNED,		/* ^_ */
894     F_CHARFWD,			/* SPACE */
895     F_EXPAND_HISTORY,		/* ! */
896     F_UNASSIGNED,		/* " */
897     F_UNASSIGNED,		/* # */
898     F_TOEND,			/* $ */
899     F_UNASSIGNED,		/* % */
900     F_UNASSIGNED,		/* & */
901     F_UNASSIGNED,		/* ' */
902     F_UNASSIGNED,		/* ( */
903     F_UNASSIGNED,		/* ) */
904     F_EXPAND_GLOB,		/* * */
905     F_DOWN_HIST,		/* + */
906     V_RCHAR_BACK,		/* , */
907     F_UP_HIST,			/* - */
908     F_UNASSIGNED,		/* . */
909     V_DSH_META,			/* / */
910     V_ZERO,			/* 0 */
911     F_ARGDIGIT,			/* 1 */
912     F_ARGDIGIT,			/* 2 */
913     F_ARGDIGIT,			/* 3 */
914     F_ARGDIGIT,			/* 4 */
915     F_ARGDIGIT,			/* 5 */
916     F_ARGDIGIT,			/* 6 */
917     F_ARGDIGIT,			/* 7 */
918     F_ARGDIGIT,			/* 8 */
919     F_ARGDIGIT,			/* 9 */
920     F_UNASSIGNED,		/* : */
921     V_RCHAR_FWD,		/* ; */
922     F_UNASSIGNED,		/* < */
923     F_UNASSIGNED,		/* = */
924     F_UNASSIGNED,		/* > */
925     V_USH_META,			/* ? */
926     F_UNASSIGNED,		/* @ */
927     V_ADDEND,			/* A */
928     V_WORDBACK,			/* B */
929     V_CHGTOEND,			/* C */
930     F_KILLEND,			/* D */
931     V_ENDWORD,			/* E */
932     V_CHAR_BACK,		/* F */
933     F_UNASSIGNED,		/* G */
934     F_UNASSIGNED,		/* H */
935     V_INSBEG,			/* I */
936     F_DOWN_SEARCH_HIST,		/* J */
937     F_UP_SEARCH_HIST,		/* K */
938     F_UNASSIGNED,		/* L */
939     F_UNASSIGNED,		/* M */
940     V_RSRCH_BACK,		/* N */
941     F_XKEY,			/* O */
942     F_UNASSIGNED,		/* P */
943     F_UNASSIGNED,		/* Q */
944     V_REPLMODE,			/* R */
945     V_SUBSTLINE,		/* S */
946     V_CHARTO_BACK,		/* T */
947     F_UNASSIGNED,		/* U */
948     F_EXPAND_VARS,		/* V */
949     V_WORDFWD,			/* W */
950     F_DELPREV,			/* X */
951     F_UNASSIGNED,		/* Y */
952     F_UNASSIGNED,		/* Z */
953     F_XKEY,			/* [ */
954     F_UNASSIGNED,		/* \ */
955     F_UNASSIGNED,		/* ] */
956     F_TOBEG,			/* ^ */
957     F_UNASSIGNED,		/* _ */
958     F_UNASSIGNED,		/* ` */
959     V_ADD,			/* a */
960     F_WORDBACK,			/* b */
961     V_CHGMETA,			/* c */
962     V_DELMETA,			/* d */
963     V_EWORD,			/* e */
964     V_CHAR_FWD,			/* f */
965     F_UNASSIGNED,		/* g */
966     F_CHARBACK,			/* h */
967     V_INSERT,			/* i */
968     F_DOWN_HIST,		/* j */
969     F_UP_HIST,			/* k */
970     F_CHARFWD,			/* l */
971     F_UNASSIGNED,		/* m */
972     V_RSRCH_FWD,		/* n */
973     F_UNASSIGNED,		/* o */
974     F_UNASSIGNED,		/* p */
975     F_UNASSIGNED,		/* q */
976     V_REPLONE,			/* r */
977     V_SUBSTCHAR,		/* s */
978     V_CHARTO_FWD,		/* t */
979     V_UNDO,			/* u */
980     F_EXPAND_VARS,		/* v */
981     V_WORDBEGNEXT,		/* w */
982     F_DELNEXT_EOF,		/* x */
983     F_UNASSIGNED,		/* y */
984     F_UNASSIGNED,		/* z */
985     F_UNASSIGNED,		/* { */
986     F_UNASSIGNED,		/* | */
987     F_UNASSIGNED,		/* } */
988     V_CHGCASE,			/* ~ */
989     F_DELPREV,			/* ^? */
990     F_UNASSIGNED,		/* M-^@ */
991     F_UNASSIGNED,		/* M-^A */
992     F_UNASSIGNED,		/* M-^B */
993     F_UNASSIGNED,		/* M-^C */
994     F_UNASSIGNED,		/* M-^D */
995     F_UNASSIGNED,		/* M-^E */
996     F_UNASSIGNED,		/* M-^F */
997     F_UNASSIGNED,		/* M-^G */
998     F_UNASSIGNED,		/* M-^H */
999     F_UNASSIGNED,		/* M-^I */
1000     F_UNASSIGNED,		/* M-^J */
1001     F_UNASSIGNED,		/* M-^K */
1002     F_UNASSIGNED,		/* M-^L */
1003     F_UNASSIGNED,		/* M-^M */
1004     F_UNASSIGNED,		/* M-^N */
1005     F_UNASSIGNED,		/* M-^O */
1006     F_UNASSIGNED,		/* M-^P */
1007     F_UNASSIGNED,		/* M-^Q */
1008     F_UNASSIGNED,		/* M-^R */
1009     F_UNASSIGNED,		/* M-^S */
1010     F_UNASSIGNED,		/* M-^T */
1011     F_UNASSIGNED,		/* M-^U */
1012     F_UNASSIGNED,		/* M-^V */
1013     F_UNASSIGNED,		/* M-^W */
1014     F_UNASSIGNED,		/* M-^X */
1015     F_UNASSIGNED,		/* M-^Y */
1016     F_UNASSIGNED,		/* M-^Z */
1017     F_UNASSIGNED,		/* M-^[ */
1018     F_UNASSIGNED,		/* M-^\ */
1019     F_UNASSIGNED,		/* M-^] */
1020     F_UNASSIGNED,		/* M-^^ */
1021     F_UNASSIGNED,		/* M-^_ */
1022     F_UNASSIGNED,		/* M-SPACE */
1023     F_UNASSIGNED,		/* M-! */
1024     F_UNASSIGNED,		/* M-" */
1025     F_UNASSIGNED,		/* M-# */
1026     F_UNASSIGNED,		/* M-$ */
1027     F_UNASSIGNED,		/* M-% */
1028     F_UNASSIGNED,		/* M-& */
1029     F_UNASSIGNED,		/* M-' */
1030     F_UNASSIGNED,		/* M-( */
1031     F_UNASSIGNED,		/* M-) */
1032     F_UNASSIGNED,		/* M-* */
1033     F_UNASSIGNED,		/* M-+ */
1034     F_UNASSIGNED,		/* M-, */
1035     F_UNASSIGNED,		/* M-- */
1036     F_UNASSIGNED,		/* M-. */
1037     F_UNASSIGNED,		/* M-/ */
1038     F_UNASSIGNED,		/* M-0 */
1039     F_UNASSIGNED,		/* M-1 */
1040     F_UNASSIGNED,		/* M-2 */
1041     F_UNASSIGNED,		/* M-3 */
1042     F_UNASSIGNED,		/* M-4 */
1043     F_UNASSIGNED,		/* M-5 */
1044     F_UNASSIGNED,		/* M-6 */
1045     F_UNASSIGNED,		/* M-7 */
1046     F_UNASSIGNED,		/* M-8 */
1047     F_UNASSIGNED,		/* M-9 */
1048     F_UNASSIGNED,		/* M-: */
1049     F_UNASSIGNED,		/* M-; */
1050     F_UNASSIGNED,		/* M-< */
1051     F_UNASSIGNED,		/* M-= */
1052     F_UNASSIGNED,		/* M-> */
1053     F_HELPME,			/* M-? */
1054     F_UNASSIGNED,		/* M-@ */
1055     F_UNASSIGNED,		/* M-A */
1056     F_UNASSIGNED,		/* M-B */
1057     F_UNASSIGNED,		/* M-C */
1058     F_UNASSIGNED,		/* M-D */
1059     F_UNASSIGNED,		/* M-E */
1060     F_UNASSIGNED,		/* M-F */
1061     F_UNASSIGNED,		/* M-G */
1062     F_UNASSIGNED,		/* M-H */
1063     F_UNASSIGNED,		/* M-I */
1064     F_UNASSIGNED,		/* M-J */
1065     F_UNASSIGNED,		/* M-K */
1066     F_UNASSIGNED,		/* M-L */
1067     F_UNASSIGNED,		/* M-M */
1068     F_UNASSIGNED,		/* M-N */
1069     F_XKEY,			/* M-O *//* extended key esc PWP Mar 88 */
1070     F_UNASSIGNED,		/* M-P */
1071     F_UNASSIGNED,		/* M-Q */
1072     F_UNASSIGNED,		/* M-R */
1073     F_UNASSIGNED,		/* M-S */
1074     F_UNASSIGNED,		/* M-T */
1075     F_UNASSIGNED,		/* M-U */
1076     F_UNASSIGNED,		/* M-V */
1077     F_UNASSIGNED,		/* M-W */
1078     F_UNASSIGNED,		/* M-X */
1079     F_UNASSIGNED,		/* M-Y */
1080     F_UNASSIGNED,		/* M-Z */
1081     F_XKEY,			/* M-[ *//* extended key esc -mf Oct 87 */
1082     F_UNASSIGNED,		/* M-\ */
1083     F_UNASSIGNED,		/* M-] */
1084     F_UNASSIGNED,		/* M-^ */
1085     F_UNASSIGNED,		/* M-_ */
1086     F_UNASSIGNED,		/* M-` */
1087     F_UNASSIGNED,		/* M-a */
1088     F_UNASSIGNED,		/* M-b */
1089     F_UNASSIGNED,		/* M-c */
1090     F_UNASSIGNED,		/* M-d */
1091     F_UNASSIGNED,		/* M-e */
1092     F_UNASSIGNED,		/* M-f */
1093     F_UNASSIGNED,		/* M-g */
1094     F_UNASSIGNED,		/* M-h */
1095     F_UNASSIGNED,		/* M-i */
1096     F_UNASSIGNED,		/* M-j */
1097     F_UNASSIGNED,		/* M-k */
1098     F_UNASSIGNED,		/* M-l */
1099     F_UNASSIGNED,		/* M-m */
1100     F_UNASSIGNED,		/* M-n */
1101     F_UNASSIGNED,		/* M-o */
1102     F_UNASSIGNED,		/* M-p */
1103     F_UNASSIGNED,		/* M-q */
1104     F_UNASSIGNED,		/* M-r */
1105     F_UNASSIGNED,		/* M-s */
1106     F_UNASSIGNED,		/* M-t */
1107     F_UNASSIGNED,		/* M-u */
1108     F_UNASSIGNED,		/* M-v */
1109     F_UNASSIGNED,		/* M-w */
1110     F_UNASSIGNED,		/* M-x */
1111     F_UNASSIGNED,		/* M-y */
1112     F_UNASSIGNED,		/* M-z */
1113     F_UNASSIGNED,		/* M-{ */
1114     F_UNASSIGNED,		/* M-| */
1115     F_UNASSIGNED,		/* M-} */
1116     F_UNASSIGNED,		/* M-~ */
1117     F_UNASSIGNED		/* M-^? */
1118 };
1119 #endif /* WINNT_NATIVE */
1120 
1121 
1122 void
1123 editinit()
1124 {
1125     struct KeyFuncs *f;
1126 
1127 #if defined(NLS_CATALOGS) || defined(WINNT_NATIVE)
1128     int i;
1129 
1130     for (i = 0; i < F_NUM_FUNCNAMES; i++)
1131 	xfree((ptr_t) FuncNames[i].desc);
1132 #endif
1133 
1134     f = FuncNames;
1135     f->name = "backward-char";
1136     f->func = F_CHARBACK;
1137     f->desc = CSAVS(3, 1, "Move back a character");
1138 
1139     f++;
1140     f->name = "backward-delete-char";
1141     f->func = F_DELPREV;
1142     f->desc = CSAVS(3, 2, "Delete the character behind cursor");
1143 
1144     f++;
1145     f->name = "backward-delete-word";
1146     f->func = F_DELWORDPREV;
1147     f->desc = CSAVS(3, 3,
1148 	"Cut from beginning of current word to cursor - saved in cut buffer");
1149 
1150     f++;
1151     f->name = "backward-kill-line";
1152     f->func = F_KILLBEG;
1153     f->desc = CSAVS(3, 4,
1154 	"Cut from beginning of line to cursor - save in cut buffer");
1155 
1156     f++;
1157     f->name = "backward-word";
1158     f->func = F_WORDBACK;
1159     f->desc = CSAVS(3, 5, "Move to beginning of current word");
1160 
1161     f++;
1162     f->name = "beginning-of-line";
1163     f->func = F_TOBEG;
1164     f->desc = CSAVS(3, 6, "Move to beginning of line");
1165 
1166     f++;
1167     f->name = "capitalize-word";
1168     f->func = F_CASECAPITAL;
1169     f->desc = CSAVS(3, 7,
1170 	"Capitalize the characters from cursor to end of current word");
1171 
1172     f++;
1173     f->name = "change-case";
1174     f->func = V_CHGCASE;
1175     f->desc = CSAVS(3, 8,
1176 	"Vi change case of character under cursor and advance one character");
1177 
1178     f++;
1179     f->name = "change-till-end-of-line";
1180     f->func = V_CHGTOEND;	/* backward compat. */
1181     f->desc = CSAVS(3, 9, "Vi change to end of line");
1182 
1183     f++;
1184     f->name = "clear-screen";
1185     f->func = F_CLEARDISP;
1186     f->desc = CSAVS(3, 10, "Clear screen leaving current line on top");
1187 
1188     f++;
1189     f->name = "complete-word";
1190     f->func = F_COMPLETE;
1191     f->desc = CSAVS(3, 11, "Complete current word");
1192 
1193     f++;
1194     f->name = "complete-word-fwd";
1195     f->func = F_COMPLETE_FWD;
1196     f->desc = CSAVS(3, 12, "Tab forward through files");
1197 
1198     f++;
1199     f->name = "complete-word-back";
1200     f->func = F_COMPLETE_BACK;
1201     f->desc = CSAVS(3, 13, "Tab backward through files");
1202 
1203     f++;
1204     f->name = "complete-word-raw";
1205     f->func = F_COMPLETE_ALL;
1206     f->desc = CSAVS(3, 14,
1207 	"Complete current word ignoring programmable completions");
1208 
1209     f++;
1210     f->name = "copy-prev-word";
1211     f->func = F_COPYPREV;
1212     f->desc = CSAVS(3, 15, "Copy current word to cursor");
1213 
1214     f++;
1215     f->name = "copy-region-as-kill";
1216     f->func = F_COPYREGION;
1217     f->desc = CSAVS(3, 16, "Copy area between mark and cursor to cut buffer");
1218 
1219     f++;
1220     f->name = "dabbrev-expand";
1221     f->func = F_DABBREV_EXPAND;
1222     f->desc = CSAVS(3, 17,
1223 		    "Expand to preceding word for which this is a prefix");
1224 
1225     f++;
1226     f->name = "delete-char";
1227     f->func = F_DELNEXT;
1228     f->desc = CSAVS(3, 18, "Delete character under cursor");
1229 
1230     f++;
1231     f->name = "delete-char-or-eof";
1232     f->func = F_DELNEXT_EOF;
1233     f->desc = CSAVS(3, 19,
1234 	"Delete character under cursor or signal end of file on an empty line");
1235 
1236     f++;
1237     f->name = "delete-char-or-list";
1238     f->func = F_DELNEXT_LIST;
1239     f->desc = CSAVS(3, 20,
1240 	"Delete character under cursor or list completions if at end of line");
1241 
1242     f++;
1243     f->name = "delete-char-or-list-or-eof";
1244     f->func = F_DELNEXT_LIST_EOF;
1245     f->desc = CSAVS(3, 21,
1246     "Delete character under cursor, list completions or signal end of file");
1247 
1248     f++;
1249     f->name = "delete-word";
1250     f->func = F_DELWORDNEXT;
1251     f->desc = CSAVS(3, 22,
1252 	"Cut from cursor to end of current word - save in cut buffer");
1253 
1254     f++;
1255     f->name = "digit";
1256     f->func = F_DIGIT;
1257     f->desc = CSAVS(3, 23, "Adds to argument if started or enters digit");
1258 
1259     f++;
1260     f->name = "digit-argument";
1261     f->func = F_ARGDIGIT;
1262     f->desc = CSAVS(3, 24, "Digit that starts argument");
1263 
1264     f++;
1265     f->name = "down-history";
1266     f->func = F_DOWN_HIST;
1267     f->desc = CSAVS(3, 25, "Move to next history line");
1268 
1269     f++;
1270     f->name = "downcase-word";
1271     f->func = F_CASELOWER;
1272     f->desc = CSAVS(3, 26,
1273 	"Lowercase the characters from cursor to end of current word");
1274 
1275     f++;
1276     f->name = "end-of-file";
1277     f->func = F_SEND_EOF;
1278     f->desc = CSAVS(3, 27, "Indicate end of file");
1279 
1280     f++;
1281     f->name = "end-of-line";
1282     f->func = F_TOEND;
1283     f->desc = CSAVS(3, 28, "Move cursor to end of line");
1284 
1285     f++;
1286     f->name = "exchange-point-and-mark";
1287     f->func = F_EXCHANGE_MARK;
1288     f->desc = CSAVS(3, 29, "Exchange the cursor and mark");
1289 
1290     f++;
1291     f->name = "expand-glob";
1292     f->func = F_EXPAND_GLOB;
1293     f->desc = CSAVS(3, 30, "Expand file name wildcards");
1294 
1295     f++;
1296     f->name = "expand-history";
1297     f->func = F_EXPAND_HISTORY;
1298     f->desc = CSAVS(3, 31, "Expand history escapes");
1299 
1300     f++;
1301     f->name = "expand-line";
1302     f->func = F_EXPAND;
1303     f->desc = CSAVS(3, 32, "Expand the history escapes in a line");
1304 
1305     f++;
1306     f->name = "expand-variables";
1307     f->func = F_EXPAND_VARS;
1308     f->desc = CSAVS(3, 33, "Expand variables");
1309 
1310     f++;
1311     f->name = "forward-char";
1312     f->func = F_CHARFWD;
1313     f->desc = CSAVS(3, 34, "Move forward one character");
1314 
1315     f++;
1316     f->name = "forward-word";
1317     f->func = F_WORDFWD;
1318     f->desc = CSAVS(3, 35, "Move forward to end of current word");
1319 
1320     f++;
1321     f->name = "gosmacs-transpose-chars";
1322     f->func = F_GCHARSWITCH;
1323     f->desc = CSAVS(3, 36, "Exchange the two characters before the cursor");
1324 
1325     f++;
1326     f->name = "history-search-backward";
1327     f->func = F_UP_SEARCH_HIST;
1328     f->desc = CSAVS(3, 37,
1329 	"Search in history backward for line beginning as current");
1330 
1331     f++;
1332     f->name = "history-search-forward";
1333     f->func = F_DOWN_SEARCH_HIST;
1334     f->desc = CSAVS(3, 38,
1335 	"Search in history forward for line beginning as current");
1336 
1337     f++;
1338     f->name = "insert-last-word";
1339     f->func = F_LAST_ITEM;
1340     f->desc = CSAVS(3, 39, "Insert last item of previous command");
1341 
1342     f++;
1343     f->name = "i-search-fwd";
1344     f->func = F_INC_FWD;
1345     f->desc = CSAVS(3, 40, "Incremental search forward");
1346 
1347     f++;
1348     f->name = "i-search-back";
1349     f->func = F_INC_BACK;
1350     f->desc = CSAVS(3, 41, "Incremental search backward");
1351 
1352     f++;
1353     f->name = "keyboard-quit";
1354     f->func = F_STARTOVER;
1355     f->desc = CSAVS(3, 42, "Clear line");
1356 
1357     f++;
1358     f->name = "kill-line";
1359     f->func = F_KILLEND;
1360     f->desc = CSAVS(3, 43, "Cut to end of line and save in cut buffer");
1361 
1362     f++;
1363     f->name = "kill-region";
1364     f->func = F_KILLREGION;
1365     f->desc = CSAVS(3, 44,
1366 	"Cut area between mark and cursor and save in cut buffer");
1367 
1368     f++;
1369     f->name = "kill-whole-line";
1370     f->func = F_KILLALL;
1371     f->desc = CSAVS(3, 45, "Cut the entire line and save in cut buffer");
1372 
1373     f++;
1374     f->name = "list-choices";
1375     f->func = F_LIST_CHOICES;
1376     f->desc = CSAVS(3, 46, "List choices for completion");
1377 
1378     f++;
1379     f->name = "list-choices-raw";
1380     f->func = F_LIST_ALL;
1381     f->desc = CSAVS(3, 47,
1382 	"List choices for completion overriding programmable completion");
1383 
1384     f++;
1385     f->name = "list-glob";
1386     f->func = F_LIST_GLOB;
1387     f->desc = CSAVS(3, 48, "List file name wildcard matches");
1388 
1389     f++;
1390     f->name = "list-or-eof";
1391     f->func = F_LIST_EOF;
1392     f->desc = CSAVS(3, 49,
1393 	"List choices for completion or indicate end of file if empty line");
1394 
1395     f++;
1396     f->name = "load-average";
1397     f->func = F_LOAD_AVERAGE;
1398     f->desc = CSAVS(3, 50, "Display load average and current process status");
1399 
1400     f++;
1401     f->name = "magic-space";
1402     f->func = F_MAGIC_SPACE;
1403     f->desc = CSAVS(3, 51, "Expand history escapes and insert a space");
1404 
1405     f++;
1406     f->name = "newline";
1407     f->func = F_NEWLINE;
1408     f->desc = CSAVS(3, 52, "Execute command");
1409 
1410     f++;
1411     f->name = "normalize-path";
1412     f->func = F_PATH_NORM;
1413     f->desc = CSAVS(3, 53,
1414 		    "Expand pathnames, eliminating leading .'s and ..'s");
1415 
1416     f++;
1417     f->name = "normalize-command";
1418     f->func = F_COMMAND_NORM;
1419     f->desc = CSAVS(3, 54,
1420 		    "Expand commands to the resulting pathname or alias");
1421 
1422     f++;
1423     f->name = "overwrite-mode";
1424     f->func = F_INSOVR;
1425     f->desc = CSAVS(3, 55,
1426 		    "Switch from insert to overwrite mode or vice versa");
1427 
1428     f++;
1429     f->name = "prefix-meta";
1430     f->func = F_METANEXT;
1431     f->desc = CSAVS(3, 56, "Add 8th bit to next character typed");
1432 
1433     f++;
1434     f->name = "quoted-insert";
1435     f->func = F_QUOTE;
1436     f->desc = CSAVS(3, 57, "Add the next character typed to the line verbatim");
1437 
1438     f++;
1439     f->name = "redisplay";
1440     f->func = F_REDISP;
1441     f->desc = CSAVS(3, 58, "Redisplay everything");
1442 
1443     f++;
1444     f->name = "run-fg-editor";
1445     f->func = F_RUN_FG_EDITOR;
1446     f->desc = CSAVS(3, 59, "Restart stopped editor");
1447 
1448     f++;
1449     f->name = "run-help";
1450     f->func = F_HELPME;
1451     f->desc = CSAVS(3, 60, "Look for help on current command");
1452 
1453     f++;
1454     f->name = "self-insert-command";
1455     f->func = F_INSERT;
1456     f->desc = CSAVS(3, 61, "This character is added to the line");
1457 
1458     f++;
1459     f->name = "sequence-lead-in";
1460     f->func = F_XKEY;
1461     f->desc = CSAVS(3, 62,
1462 	"This character is the first in a character sequence");
1463 
1464     f++;
1465     f->name = "set-mark-command";
1466     f->func = F_SET_MARK;
1467     f->desc = CSAVS(3, 63, "Set the mark at cursor");
1468 
1469     f++;
1470     f->name = "spell-word";
1471     f->func = F_CORRECT;
1472     f->desc = CSAVS(3, 64, "Correct the spelling of current word");
1473 
1474     f++;
1475     f->name = "spell-line";
1476     f->func = F_CORRECT_L;
1477     f->desc = CSAVS(3, 65, "Correct the spelling of entire line");
1478 
1479     f++;
1480     f->name = "stuff-char";
1481     f->func = F_STUFF_CHAR;
1482     f->desc = CSAVS(3, 66, "Send character to tty in cooked mode");
1483 
1484     f++;
1485     f->name = "toggle-literal-history";
1486     f->func = F_TOGGLE_HIST;
1487     f->desc = CSAVS(3, 67,
1488 	"Toggle between literal and lexical current history line");
1489 
1490     f++;
1491     f->name = "transpose-chars";
1492     f->func = F_CHARSWITCH;
1493     f->desc = CSAVS(3, 68,
1494 	"Exchange the character to the left of the cursor with the one under");
1495 
1496     f++;
1497     f->name = "transpose-gosling";
1498     f->func = F_GCHARSWITCH;
1499     f->desc = CSAVS(3, 69, "Exchange the two characters before the cursor");
1500 
1501     f++;
1502     f->name = "tty-dsusp";
1503     f->func = F_TTY_DSUSP;
1504     f->desc = CSAVS(3, 70, "Tty delayed suspend character");
1505 
1506     f++;
1507     f->name = "tty-flush-output";
1508     f->func = F_TTY_FLUSHO;
1509     f->desc = CSAVS(3, 71, "Tty flush output character");
1510 
1511     f++;
1512     f->name = "tty-sigintr";
1513     f->func = F_TTY_INT;
1514     f->desc = CSAVS(3, 72, "Tty interrupt character");
1515 
1516     f++;
1517     f->name = "tty-sigquit";
1518     f->func = F_TTY_QUIT;
1519     f->desc = CSAVS(3, 73, "Tty quit character");
1520 
1521     f++;
1522     f->name = "tty-sigtsusp";
1523     f->func = F_TTY_TSUSP;
1524     f->desc = CSAVS(3, 74, "Tty suspend character");
1525 
1526     f++;
1527     f->name = "tty-start-output";
1528     f->func = F_TTY_STARTO;
1529     f->desc = CSAVS(3, 75, "Tty allow output character");
1530 
1531     f++;
1532     f->name = "tty-stop-output";
1533     f->func = F_TTY_STOPO;
1534     f->desc = CSAVS(3, 76, "Tty disallow output character");
1535 
1536     f++;
1537     f->name = "undefined-key";
1538     f->func = F_UNASSIGNED;
1539     f->desc = CSAVS(3, 77, "Indicates unbound character");
1540 
1541     f++;
1542     f->name = "universal-argument";
1543     f->func = F_ARGFOUR;
1544     f->desc = CSAVS(3, 78, "Emacs universal argument (argument times 4)");
1545 
1546     f++;
1547     f->name = "up-history";
1548     f->func = F_UP_HIST;
1549     f->desc = CSAVS(3, 79, "Move to previous history line");
1550 
1551     f++;
1552     f->name = "upcase-word";
1553     f->func = F_CASEUPPER;
1554     f->desc = CSAVS(3, 80,
1555 	"Uppercase the characters from cursor to end of current word");
1556 
1557     f++;
1558     f->name = "vi-beginning-of-next-word";
1559     f->func = V_WORDBEGNEXT;
1560     f->desc = CSAVS(3, 81, "Vi goto the beginning of next word");
1561 
1562     f++;
1563     f->name = "vi-add";
1564     f->func = V_ADD;
1565     f->desc = CSAVS(3, 82, "Vi enter insert mode after the cursor");
1566 
1567     f++;
1568     f->name = "vi-add-at-eol";
1569     f->func = V_ADDEND;
1570     f->desc = CSAVS(3, 83, "Vi enter insert mode at end of line");
1571 
1572     f++;
1573     f->name = "vi-chg-case";
1574     f->func = V_CHGCASE;
1575     f->desc = CSAVS(3, 84,
1576 	"Vi change case of character under cursor and advance one character");
1577 
1578     f++;
1579     f->name = "vi-chg-meta";
1580     f->func = V_CHGMETA;
1581     f->desc = CSAVS(3, 85, "Vi change prefix command");
1582 
1583     f++;
1584     f->name = "vi-chg-to-eol";
1585     f->func = V_CHGTOEND;
1586     f->desc = CSAVS(3, 86, "Vi change to end of line");
1587 
1588     f++;
1589     f->name = "vi-cmd-mode";
1590     f->func = V_CMD_MODE;
1591     f->desc = CSAVS(3, 87,
1592 	"Enter vi command mode (use alternative key bindings)");
1593 
1594     f++;
1595     f->name = "vi-cmd-mode-complete";
1596     f->func = V_CM_COMPLETE;
1597     f->desc = CSAVS(3, 88, "Vi command mode complete current word");
1598 
1599     f++;
1600     f->name = "vi-delprev";
1601     f->func = V_DELPREV;
1602     f->desc = CSAVS(3, 89, "Vi move to previous character (backspace)");
1603 
1604     f++;
1605     f->name = "vi-delmeta";
1606     f->func = V_DELMETA;
1607     f->desc = CSAVS(3, 90, "Vi delete prefix command");
1608 
1609     f++;
1610     f->name = "vi-endword";
1611     f->func = V_ENDWORD;
1612     f->desc = CSAVS(3, 91,
1613 	"Vi move to the end of the current space delimited word");
1614 
1615     f++;
1616     f->name = "vi-eword";
1617     f->func = V_EWORD;
1618     f->desc = CSAVS(3, 92, "Vi move to the end of the current word");
1619 
1620     f++;
1621     f->name = "vi-char-back";
1622     f->func = V_CHAR_BACK;
1623     f->desc = CSAVS(3, 93, "Vi move to the character specified backward");
1624 
1625     f++;
1626     f->name = "vi-char-fwd";
1627     f->func = V_CHAR_FWD;
1628     f->desc = CSAVS(3, 94, "Vi move to the character specified forward");
1629 
1630     f++;
1631     f->name = "vi-charto-back";
1632     f->func = V_CHARTO_BACK;
1633     f->desc = CSAVS(3, 95, "Vi move up to the character specified backward");
1634 
1635     f++;
1636     f->name = "vi-charto-fwd";
1637     f->func = V_CHARTO_FWD;
1638     f->desc = CSAVS(3, 96, "Vi move up to the character specified forward");
1639 
1640     f++;
1641     f->name = "vi-insert";
1642     f->func = V_INSERT;
1643     f->desc = CSAVS(3, 97, "Enter vi insert mode");
1644 
1645     f++;
1646     f->name = "vi-insert-at-bol";
1647     f->func = V_INSBEG;
1648     f->desc = CSAVS(3, 98, "Enter vi insert mode at beginning of line");
1649 
1650     f++;
1651     f->name = "vi-repeat-char-fwd";
1652     f->func = V_RCHAR_FWD;
1653     f->desc = CSAVS(3, 99,
1654 	"Vi repeat current character search in the same search direction");
1655 
1656     f++;
1657     f->name = "vi-repeat-char-back";
1658     f->func = V_RCHAR_BACK;
1659     f->desc = CSAVS(3, 100,
1660 	"Vi repeat current character search in the opposite search direction");
1661 
1662     f++;
1663     f->name = "vi-repeat-search-fwd";
1664     f->func = V_RSRCH_FWD;
1665     f->desc = CSAVS(3, 101,
1666 	"Vi repeat current search in the same search direction");
1667 
1668     f++;
1669     f->name = "vi-repeat-search-back";
1670     f->func = V_RSRCH_BACK;
1671     f->desc = CSAVS(3, 102,
1672 	"Vi repeat current search in the opposite search direction");
1673 
1674     f++;
1675     f->name = "vi-replace-char";
1676     f->func = V_REPLONE;
1677     f->desc = CSAVS(3, 103,
1678 	"Vi replace character under the cursor with the next character typed");
1679 
1680     f++;
1681     f->name = "vi-replace-mode";
1682     f->func = V_REPLMODE;
1683     f->desc = CSAVS(3, 104, "Vi replace mode");
1684 
1685     f++;
1686     f->name = "vi-search-back";
1687     f->func = V_USH_META;
1688     f->desc = CSAVS(3, 105, "Vi search history backward");
1689 
1690     f++;
1691     f->name = "vi-search-fwd";
1692     f->func = V_DSH_META;
1693     f->desc = CSAVS(3, 106, "Vi search history forward");
1694 
1695     f++;
1696     f->name = "vi-substitute-char";
1697     f->func = V_SUBSTCHAR;
1698     f->desc = CSAVS(3, 107,
1699 	"Vi replace character under the cursor and enter insert mode");
1700 
1701     f++;
1702     f->name = "vi-substitute-line";
1703     f->func = V_SUBSTLINE;
1704     f->desc = CSAVS(3, 108, "Vi replace entire line");
1705 
1706     f++;
1707     f->name = "vi-word-back";
1708     f->func = V_WORDBACK;
1709     f->desc = CSAVS(3, 109, "Vi move to the previous word");
1710 
1711     f++;
1712     f->name = "vi-word-fwd";
1713     f->func = V_WORDFWD;
1714     f->desc = CSAVS(3, 110, "Vi move to the next word");
1715 
1716     f++;
1717     f->name = "vi-undo";
1718     f->func = V_UNDO;
1719     f->desc = CSAVS(3, 111, "Vi undo last change");
1720 
1721     f++;
1722     f->name = "vi-zero";
1723     f->func = V_ZERO;
1724     f->desc = CSAVS(3, 112, "Vi goto the beginning of line");
1725 
1726     f++;
1727     f->name = "which-command";
1728     f->func = F_WHICH;
1729     f->desc = CSAVS(3, 113, "Perform which of current command");
1730 
1731     f++;
1732     f->name = "yank";
1733     f->func = F_YANK_KILL;
1734     f->desc = CSAVS(3, 114, "Paste cut buffer at cursor position");
1735 
1736     f++;
1737     f->name = "yank-pop";
1738     f->func = F_YANK_POP;
1739     f->desc = CSAVS(3, 115,
1740 	"Replace just-yanked text with yank from earlier kill");
1741 
1742     f++;
1743     f->name = "e_copy_to_clipboard";
1744     f->func = F_COPY_CLIP;
1745     f->desc = CSAVS(3, 116,
1746 	"(WIN32 only) Copy cut buffer to system clipboard");
1747 
1748     f++;
1749     f->name = "e_paste_from_clipboard";
1750     f->func = F_PASTE_CLIP;
1751     f->desc = CSAVS(3, 117,
1752 	"(WIN32 only) Paste clipboard buffer at cursor position");
1753 
1754     f++;
1755     f->name = "e_dosify_next";
1756     f->func = F_DOSIFY_NEXT;
1757     f->desc = CSAVS(3, 118,
1758 	"(WIN32 only) Convert each '/' in next word to '\\\\'");
1759 
1760     f++;
1761     f->name = "e_dosify_prev";
1762     f->func = F_DOSIFY_PREV;
1763     f->desc = CSAVS(3, 119,
1764 	"(WIN32 only) Convert each '/' in previous word to '\\\\'");
1765 
1766     f++;
1767     f->name = "e_page_up";
1768     f->func = F_PAGE_UP;
1769     f->desc = CSAVS(3, 120, "(WIN32 only) Page visible console window up");
1770 
1771     f++;
1772     f->name = "e_page_down";
1773     f->func = F_PAGE_DOWN;
1774     f->desc = CSAVS(3, 121, "(WIN32 only) Page visible console window down");
1775 
1776     f++;
1777     f->name = NULL;
1778     f->func = 0;
1779     f->desc = NULL;
1780 
1781     f++;
1782     if (f - FuncNames != F_NUM_FUNCNAMES)
1783 	abort();
1784 }
1785 
1786 #ifdef DEBUG_EDIT
1787 void
1788 CheckMaps()
1789 {		/* check the size of the key maps */
1790     int     c1 = (NT_NUM_KEYS * sizeof(KEYCMD));
1791 
1792     if ((sizeof(CcKeyMap)) != c1)
1793 	xprintf("CcKeyMap should be %d entries, but is %d.\r\n",
1794 		NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD)));
1795 
1796     if ((sizeof(CcAltMap)) != c1)
1797 	xprintf("CcAltMap should be %d entries, but is %d.\r\n",
1798 		NT_NUM_KEYS, (sizeof(CcAltMap) / sizeof(KEYCMD)));
1799 
1800     if ((sizeof(CcEmacsMap)) != c1)
1801 	xprintf("CcEmacsMap should be %d entries, but is %d.\r\n",
1802 		NT_NUM_KEYS, (sizeof(CcEmacsMap) / sizeof(KEYCMD)));
1803 
1804     if ((sizeof(CcViMap)) != c1)
1805 	xprintf("CcViMap should be %d entries, but is %d.\r\n",
1806 		NT_NUM_KEYS, (sizeof(CcViMap) / sizeof(KEYCMD)));
1807 
1808     if ((sizeof(CcViCmdMap)) != c1)
1809 	xprintf("CcViCmdMap should be %d entries, but is %d.\r\n",
1810 		NT_NUM_KEYS, (sizeof(CcViCmdMap) / sizeof(KEYCMD)));
1811 }
1812 
1813 #endif
1814 
1815 int    MapsAreInited = 0;
1816 int    NLSMapsAreInited = 0;
1817 int    NoNLSRebind;
1818 
1819 void
1820 ed_InitNLSMaps()
1821 {
1822     int i;
1823 
1824     if (AsciiOnly)
1825 	return;
1826     if (NoNLSRebind)
1827 	return;
1828     for (i = 0200; i <= 0377; i++) {
1829 	if (Isprint(CTL_ESC(i))) {
1830 	    CcKeyMap[CTL_ESC(i)] = F_INSERT;
1831 	}
1832     }
1833     NLSMapsAreInited = 1;
1834 }
1835 
1836 static void
1837 ed_InitMetaBindings()
1838 {
1839     Char    buf[3];
1840     int     i;
1841     CStr    cstr;
1842     KEYCMD *map;
1843 
1844     map = CcKeyMap;
1845     for (i = 0; i <= 0377 && CcKeyMap[CTL_ESC(i)] != F_METANEXT; i++)
1846 	continue;
1847     if (i > 0377) {
1848 	for (i = 0; i <= 0377 && CcAltMap[CTL_ESC(i)] != F_METANEXT; i++)
1849 	    continue;
1850 	if (i > 0377) {
1851 	    i = '\033';
1852 	    if (VImode)
1853 		map = CcAltMap;
1854 	}
1855 	else {
1856 	    map = CcAltMap;
1857 	}
1858     }
1859     buf[0] = (Char)CTL_ESC(i);
1860     buf[2] = 0;
1861     cstr.buf = buf;
1862     cstr.len = 2;
1863     for (i = 0200; i <= 0377; i++) {
1864 	if (map[CTL_ESC(i)] != F_INSERT && map[CTL_ESC(i)] != F_UNASSIGNED && map[CTL_ESC(i)] != F_XKEY) {
1865 	    buf[1] = CTL_ESC(i & ASCII);
1866 	    AddXkey(&cstr, XmapCmd((int) map[CTL_ESC(i)]), XK_CMD);
1867 	}
1868     }
1869     map[buf[0]] = F_XKEY;
1870 }
1871 
1872 void
1873 ed_InitVIMaps()
1874 {
1875     int i;
1876 
1877     VImode = 1;
1878     ResetXmap();
1879     for (i = 0; i < NT_NUM_KEYS; i++) {
1880 	CcKeyMap[i] = CcViMap[i];
1881 	CcAltMap[i] = CcViCmdMap[i];
1882     }
1883     ed_InitMetaBindings();
1884     ed_InitNLSMaps();
1885     ResetArrowKeys();
1886     BindArrowKeys();
1887 }
1888 
1889 void
1890 ed_InitEmacsMaps()
1891 {
1892     int     i;
1893     Char    buf[3];
1894     CStr    cstr;
1895     cstr.buf = buf;
1896     cstr.len = 2;
1897 
1898     VImode = 0;
1899     ResetXmap();
1900     for (i = 0; i < NT_NUM_KEYS; i++) {
1901 	CcKeyMap[i] = CcEmacsMap[i];
1902 	CcAltMap[i] = F_UNASSIGNED;
1903     }
1904     ed_InitMetaBindings();
1905     ed_InitNLSMaps();
1906     buf[0] = CTL_ESC('\030');
1907     buf[2] = 0;
1908     buf[1] = CTL_ESC('\030');
1909     AddXkey(&cstr, XmapCmd(F_EXCHANGE_MARK), XK_CMD);
1910     buf[1] = '*';
1911     AddXkey(&cstr, XmapCmd(F_EXPAND_GLOB),   XK_CMD);
1912     buf[1] = '$';
1913     AddXkey(&cstr, XmapCmd(F_EXPAND_VARS),   XK_CMD);
1914     buf[1] = 'G';
1915     AddXkey(&cstr, XmapCmd(F_LIST_GLOB),     XK_CMD);
1916     buf[1] = 'g';
1917     AddXkey(&cstr, XmapCmd(F_LIST_GLOB),     XK_CMD);
1918     buf[1] = 'n';
1919     AddXkey(&cstr, XmapCmd(F_PATH_NORM),     XK_CMD);
1920     buf[1] = 'N';
1921     AddXkey(&cstr, XmapCmd(F_PATH_NORM),     XK_CMD);
1922     buf[1] = '?';
1923     AddXkey(&cstr, XmapCmd(F_COMMAND_NORM),  XK_CMD);
1924     buf[1] = '\t';
1925     AddXkey(&cstr, XmapCmd(F_COMPLETE_ALL),  XK_CMD);
1926     buf[1] = CTL_ESC('\004');	/* ^D */
1927     AddXkey(&cstr, XmapCmd(F_LIST_ALL),      XK_CMD);
1928     ResetArrowKeys();
1929     BindArrowKeys();
1930 }
1931 
1932 void
1933 ed_InitMaps()
1934 {
1935     if (MapsAreInited)
1936 	return;
1937 #ifndef IS_ASCII
1938     /* This machine has an EBCDIC charset. The assumptions made for the
1939      * initialized keymaps therefore don't hold, since they are based on
1940      * ASCII (or ISO8859-1).
1941      * Here, we do a one-time transformation to EBCDIC environment
1942      * for the key initializations.
1943      */
1944     {
1945 	KEYCMD temp[NT_NUM_KEYS];
1946 	static KEYCMD *const list[3] = { CcEmacsMap, CcViMap, CcViCmdMap };
1947 	int i, table;
1948 
1949 	for (table=0; table<3; ++table)
1950 	{
1951 	    /* copy ASCII ordered map to temp table */
1952 	    for (i = 0; i < NT_NUM_KEYS; i++) {
1953 		temp[i] = list[table][i];
1954 	    }
1955 	    /* write back as EBCDIC ordered map */
1956 	    for (i = 0; i < NT_NUM_KEYS; i++) {
1957 		list[table][_toebcdic[i]] = temp[i];
1958 	    }
1959 	}
1960     }
1961 #endif /* !IS_ASCII */
1962 
1963 #ifdef VIDEFAULT
1964     ed_InitVIMaps();
1965 #else
1966     ed_InitEmacsMaps();
1967 #endif
1968 
1969     MapsAreInited = 1;
1970 }
1971