forked from tcsh-org/tcsh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ed.defns.c
1987 lines (1827 loc) · 51 KB
/
ed.defns.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* ed.defns.c: Editor function definitions and initialization
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "sh.h"
#include "ed.h"
static void ed_InitMetaBindings (void);
PFCmd CcFuncTbl[] = { /* table of available commands */
e_unassigned,
/* no #define here -- this is a dummy to detect initing of the key map */
e_unassigned,
#define F_UNASSIGNED 1
e_insert,
#define F_INSERT 2
e_newline,
#define F_NEWLINE 3
e_delprev,
#define F_DELPREV 4
e_delnext,
#define F_DELNEXT 5
e_toend,
#define F_TOEND 6
e_tobeg,
#define F_TOBEG 7
e_charback,
#define F_CHARBACK 8
e_charfwd,
#define F_CHARFWD 9
e_quote,
#define F_QUOTE 10
e_startover,
#define F_STARTOVER 11
e_redisp,
#define F_REDISP 12
e_tty_int,
#define F_TTY_INT 13
e_wordback,
#define F_WORDBACK 14
e_wordfwd,
#define F_WORDFWD 15
e_cleardisp,
#define F_CLEARDISP 16
e_complete,
#define F_COMPLETE 17
e_correct,
#define F_CORRECT 18
e_up_hist,
#define F_UP_HIST 19
e_down_hist,
#define F_DOWN_HIST 20
e_up_search_hist,
#define F_UP_SEARCH_HIST 21
e_down_search_hist,
#define F_DOWN_SEARCH_HIST 22
e_helpme,
#define F_HELPME 23
e_list_choices,
#define F_LIST_CHOICES 24
e_delwordprev,
#define F_DELWORDPREV 25
e_delwordnext,
#define F_DELWORDNEXT 26
e_digit,
#define F_DIGIT 27
e_killend,
#define F_KILLEND 28
e_killbeg,
#define F_KILLBEG 29
e_metanext,
#define F_METANEXT 30
e_send_eof,
#define F_SEND_EOF 31
e_charswitch,
#define F_CHARSWITCH 32
e_which,
#define F_WHICH 33
e_yank_kill,
#define F_YANK_KILL 34
e_tty_dsusp,
#define F_TTY_DSUSP 35
e_tty_flusho,
#define F_TTY_FLUSHO 36
e_tty_quit,
#define F_TTY_QUIT 37
e_tty_tsusp,
#define F_TTY_TSUSP 38
e_tty_stopo,
#define F_TTY_STOPO 39
e_tty_starto,
#define F_TTY_STARTO 40
e_argfour,
#define F_ARGFOUR 41
e_set_mark,
#define F_SET_MARK 42
e_exchange_mark,
#define F_EXCHANGE_MARK 43
e_last_item,
#define F_LAST_ITEM 44
e_delnext_list_eof,
#define F_DELNEXT_LIST_EOF 45
v_cmd_mode,
#define V_CMD_MODE 46
v_insert,
#define V_INSERT 47
e_argdigit,
#define F_ARGDIGIT 48
e_killregion,
#define F_KILLREGION 49
e_copyregion,
#define F_COPYREGION 50
e_gcharswitch,
#define F_GCHARSWITCH 51
e_run_fg_editor,
#define F_RUN_FG_EDITOR 52
e_unassigned, /* place holder for sequence lead in character */
#define F_XKEY 53
e_uppercase,
#define F_CASEUPPER 54
e_lowercase,
#define F_CASELOWER 55
e_capitalcase,
#define F_CASECAPITAL 56
v_zero,
#define V_ZERO 57
v_add,
#define V_ADD 58
v_addend,
#define V_ADDEND 59
v_wordbegnext,
#define V_WORDBEGNEXT 60
e_killall,
#define F_KILLALL 61
e_unassigned,
/* F_EXTENDNEXT removed */
v_insbeg,
#define V_INSBEG 63
v_replmode,
#define V_REPLMODE 64
v_replone,
#define V_REPLONE 65
v_substline,
#define V_SUBSTLINE 66
v_substchar,
#define V_SUBSTCHAR 67
v_chgtoend,
#define V_CHGTOEND 68
e_list_eof,
#define F_LIST_EOF 69
e_list_glob,
#define F_LIST_GLOB 70
e_expand_history,
#define F_EXPAND_HISTORY 71
e_magic_space,
#define F_MAGIC_SPACE 72
e_insovr,
#define F_INSOVR 73
v_cm_complete,
#define V_CM_COMPLETE 74
e_copyprev,
#define F_COPYPREV 75
e_correctl,
#define F_CORRECT_L 76
e_expand_glob,
#define F_EXPAND_GLOB 77
e_expand_vars,
#define F_EXPAND_VARS 78
e_toggle_hist,
#define F_TOGGLE_HIST 79
v_change_case,
#define V_CHGCASE 80
e_expand,
#define F_EXPAND 81
e_load_average,
#define F_LOAD_AVERAGE 82
v_delprev,
#define V_DELPREV 83
v_delmeta,
#define V_DELMETA 84
v_wordfwd,
#define V_WORDFWD 85
v_wordback,
#define V_WORDBACK 86
v_endword,
#define V_ENDWORD 87
v_eword,
#define V_EWORD 88
v_undo,
#define V_UNDO 89
v_ush_meta,
#define V_USH_META 90
v_dsh_meta,
#define V_DSH_META 91
v_rsrch_fwd,
#define V_RSRCH_FWD 92
v_rsrch_back,
#define V_RSRCH_BACK 93
v_char_fwd,
#define V_CHAR_FWD 94
v_char_back,
#define V_CHAR_BACK 95
v_chgmeta,
#define V_CHGMETA 96
e_inc_fwd,
#define F_INC_FWD 97
e_inc_back,
#define F_INC_BACK 98
v_rchar_fwd,
#define V_RCHAR_FWD 99
v_rchar_back,
#define V_RCHAR_BACK 100
v_charto_fwd,
#define V_CHARTO_FWD 101
v_charto_back,
#define V_CHARTO_BACK 102
e_normalize_path,
#define F_PATH_NORM 103
e_delnext_eof, /* added by [email protected] (920818) */
#define F_DELNEXT_EOF 104
e_stuff_char,
#define F_STUFF_CHAR 105
e_complete_all,
#define F_COMPLETE_ALL 106
e_list_all,
#define F_LIST_ALL 107
e_complete_fwd,
#define F_COMPLETE_FWD 108
e_complete_back,
#define F_COMPLETE_BACK 109
e_delnext_list,
#define F_DELNEXT_LIST 110
e_normalize_command,
#define F_COMMAND_NORM 111
e_dabbrev_expand,
#define F_DABBREV_EXPAND 112
e_copy_to_clipboard,
#define F_COPY_CLIP 113
e_paste_from_clipboard,
#define F_PASTE_CLIP 114
e_dosify_next,
#define F_DOSIFY_NEXT 115
e_dosify_prev,
#define F_DOSIFY_PREV 116
e_page_up,
#define F_PAGE_UP 117
e_page_down,
#define F_PAGE_DOWN 118
e_yank_pop,
#define F_YANK_POP 119
e_newline_hold,
#define F_NEWLINE_HOLD 120
e_newline_down_hist,
#define F_NEWLINE_DOWN_HIST 121
0 /* DUMMY VALUE */
#define F_NUM_FNS 122
};
KEYCMD NumFuns = F_NUM_FNS;
KEYCMD CcKeyMap[NT_NUM_KEYS]; /* the real key map */
KEYCMD CcAltMap[NT_NUM_KEYS]; /* the alternative key map */
#define F_NUM_FUNCNAMES (F_NUM_FNS + 2)
struct KeyFuncs FuncNames[F_NUM_FUNCNAMES];
#ifdef WINNT_NATIVE
extern KEYCMD CcEmacsMap[];
extern KEYCMD CcViMap[];
extern KEYCMD CcViCmdMap[];
#else /* !WINNT_NATIVE*/
KEYCMD CcEmacsMap[] = {
/* keymap table, each index into above tbl; should be 256*sizeof(KEYCMD)
bytes long */
F_SET_MARK, /* ^@ */
F_TOBEG, /* ^A */
F_CHARBACK, /* ^B */
F_TTY_INT, /* ^C */
F_DELNEXT_LIST_EOF, /* ^D */
F_TOEND, /* ^E */
F_CHARFWD, /* ^F */
F_UNASSIGNED, /* ^G */
F_DELPREV, /* ^H */
F_COMPLETE, /* ^I */
F_NEWLINE, /* ^J */
F_KILLEND, /* ^K */
F_CLEARDISP, /* ^L */
F_NEWLINE, /* ^M */
F_DOWN_HIST, /* ^N */
F_TTY_FLUSHO, /* ^O */
F_UP_HIST, /* ^P */
F_TTY_STARTO, /* ^Q */
F_REDISP, /* ^R */
F_TTY_STOPO, /* ^S */
F_CHARSWITCH, /* ^T */
F_KILLALL, /* ^U */
F_QUOTE, /* ^V */
F_KILLREGION, /* ^W */
F_XKEY, /* ^X */
F_YANK_KILL, /* ^Y */
F_TTY_TSUSP, /* ^Z */
F_METANEXT, /* ^[ */
F_TTY_QUIT, /* ^\ */
F_TTY_DSUSP, /* ^] */
F_UNASSIGNED, /* ^^ */
F_UNASSIGNED, /* ^_ */
F_INSERT, /* SPACE */
F_INSERT, /* ! */
F_INSERT, /* " */
F_INSERT, /* # */
F_INSERT, /* $ */
F_INSERT, /* % */
F_INSERT, /* & */
F_INSERT, /* ' */
F_INSERT, /* ( */
F_INSERT, /* ) */
F_INSERT, /* * */
F_INSERT, /* + */
F_INSERT, /* , */
F_INSERT, /* - */
F_INSERT, /* . */
F_INSERT, /* / */
F_DIGIT, /* 0 */
F_DIGIT, /* 1 */
F_DIGIT, /* 2 */
F_DIGIT, /* 3 */
F_DIGIT, /* 4 */
F_DIGIT, /* 5 */
F_DIGIT, /* 6 */
F_DIGIT, /* 7 */
F_DIGIT, /* 8 */
F_DIGIT, /* 9 */
F_INSERT, /* : */
F_INSERT, /* ; */
F_INSERT, /* < */
F_INSERT, /* = */
F_INSERT, /* > */
F_INSERT, /* ? */
F_INSERT, /* @ */
F_INSERT, /* A */
F_INSERT, /* B */
F_INSERT, /* C */
F_INSERT, /* D */
F_INSERT, /* E */
F_INSERT, /* F */
F_INSERT, /* G */
F_INSERT, /* H */
F_INSERT, /* I */
F_INSERT, /* J */
F_INSERT, /* K */
F_INSERT, /* L */
F_INSERT, /* M */
F_INSERT, /* N */
F_INSERT, /* O */
F_INSERT, /* P */
F_INSERT, /* Q */
F_INSERT, /* R */
F_INSERT, /* S */
F_INSERT, /* T */
F_INSERT, /* U */
F_INSERT, /* V */
F_INSERT, /* W */
F_INSERT, /* X */
F_INSERT, /* Y */
F_INSERT, /* Z */
F_INSERT, /* [ */
F_INSERT, /* \ */
F_INSERT, /* ] */
F_INSERT, /* ^ */
F_INSERT, /* _ */
F_INSERT, /* ` */
F_INSERT, /* a */
F_INSERT, /* b */
F_INSERT, /* c */
F_INSERT, /* d */
F_INSERT, /* e */
F_INSERT, /* f */
F_INSERT, /* g */
F_INSERT, /* h */
F_INSERT, /* i */
F_INSERT, /* j */
F_INSERT, /* k */
F_INSERT, /* l */
F_INSERT, /* m */
F_INSERT, /* n */
F_INSERT, /* o */
F_INSERT, /* p */
F_INSERT, /* q */
F_INSERT, /* r */
F_INSERT, /* s */
F_INSERT, /* t */
F_INSERT, /* u */
F_INSERT, /* v */
F_INSERT, /* w */
F_INSERT, /* x */
F_INSERT, /* y */
F_INSERT, /* z */
F_INSERT, /* { */
F_INSERT, /* | */
F_INSERT, /* } */
F_INSERT, /* ~ */
F_DELPREV, /* ^? */
F_UNASSIGNED, /* M-^@ */
F_UNASSIGNED, /* M-^A */
F_UNASSIGNED, /* M-^B */
F_UNASSIGNED, /* M-^C */
F_LIST_CHOICES, /* M-^D */
F_UNASSIGNED, /* M-^E */
F_UNASSIGNED, /* M-^F */
F_UNASSIGNED, /* M-^G */
F_DELWORDPREV, /* M-^H */
F_COMPLETE, /* M-^I */
F_UNASSIGNED, /* M-^J */
F_UNASSIGNED, /* M-^K */
F_CLEARDISP, /* M-^L */
F_UNASSIGNED, /* M-^M */
F_UNASSIGNED, /* M-^N */
F_UNASSIGNED, /* M-^O */
F_UNASSIGNED, /* M-^P */
F_UNASSIGNED, /* M-^Q */
F_UNASSIGNED, /* M-^R */
F_UNASSIGNED, /* M-^S */
F_UNASSIGNED, /* M-^T */
F_UNASSIGNED, /* M-^U */
F_UNASSIGNED, /* M-^V */
F_UNASSIGNED, /* M-^W */
F_UNASSIGNED, /* M-^X */
F_UNASSIGNED, /* M-^Y */
F_RUN_FG_EDITOR, /* M-^Z */
F_COMPLETE, /* M-^[ */
F_UNASSIGNED, /* M-^\ */
F_UNASSIGNED, /* M-^] */
F_UNASSIGNED, /* M-^^ */
F_COPYPREV, /* M-^_ */
F_EXPAND_HISTORY, /* M-SPACE */
F_EXPAND_HISTORY, /* M-! */
F_UNASSIGNED, /* M-" */
F_UNASSIGNED, /* M-# */
F_CORRECT_L, /* M-$ */
F_UNASSIGNED, /* M-% */
F_UNASSIGNED, /* M-& */
F_UNASSIGNED, /* M-' */
F_UNASSIGNED, /* M-( */
F_UNASSIGNED, /* M-) */
F_UNASSIGNED, /* M-* */
F_UNASSIGNED, /* M-+ */
F_UNASSIGNED, /* M-, */
F_UNASSIGNED, /* M-- */
F_UNASSIGNED, /* M-. */
F_DABBREV_EXPAND, /* M-/ */
F_ARGDIGIT, /* M-0 */
F_ARGDIGIT, /* M-1 */
F_ARGDIGIT, /* M-2 */
F_ARGDIGIT, /* M-3 */
F_ARGDIGIT, /* M-4 */
F_ARGDIGIT, /* M-5 */
F_ARGDIGIT, /* M-6 */
F_ARGDIGIT, /* M-7 */
F_ARGDIGIT, /* M-8 */
F_ARGDIGIT, /* M-9 */
F_UNASSIGNED, /* M-: */
F_UNASSIGNED, /* M-; */
F_UNASSIGNED, /* M-< */
F_UNASSIGNED, /* M-= */
F_UNASSIGNED, /* M-> */
F_WHICH, /* M-? */
F_UNASSIGNED, /* M-@ */
F_NEWLINE_HOLD, /* M-A */
F_WORDBACK, /* M-B */
F_CASECAPITAL, /* M-C */
F_DELWORDNEXT, /* M-D */
F_UNASSIGNED, /* M-E */
F_WORDFWD, /* M-F */
F_UNASSIGNED, /* M-G */
F_HELPME, /* M-H */
F_UNASSIGNED, /* M-I */
F_UNASSIGNED, /* M-J */
F_UNASSIGNED, /* M-K */
F_CASELOWER, /* M-L */
F_UNASSIGNED, /* M-M */
F_DOWN_SEARCH_HIST, /* M-N */
F_XKEY, /* M-O *//* extended key esc PWP Mar 88 */
F_UP_SEARCH_HIST, /* M-P */
F_UNASSIGNED, /* M-Q */
F_TOGGLE_HIST, /* M-R */
F_CORRECT, /* M-S */
F_UNASSIGNED, /* M-T */
F_CASEUPPER, /* M-U */
F_UNASSIGNED, /* M-V */
F_COPYREGION, /* M-W */
F_UNASSIGNED, /* M-X */
F_YANK_POP, /* M-Y */
F_UNASSIGNED, /* M-Z */
F_XKEY, /* M-[ *//* extended key esc -mf Oct 87 */
F_UNASSIGNED, /* M-\ */
F_UNASSIGNED, /* M-] */
F_UNASSIGNED, /* M-^ */
F_LAST_ITEM, /* M-_ */
F_UNASSIGNED, /* M-` */
F_NEWLINE_HOLD, /* M-a */
F_WORDBACK, /* M-b */
F_CASECAPITAL, /* M-c */
F_DELWORDNEXT, /* M-d */
F_UNASSIGNED, /* M-e */
F_WORDFWD, /* M-f */
F_UNASSIGNED, /* M-g */
F_HELPME, /* M-h */
F_UNASSIGNED, /* M-i */
F_UNASSIGNED, /* M-j */
F_UNASSIGNED, /* M-k */
F_CASELOWER, /* M-l */
F_UNASSIGNED, /* M-m */
F_DOWN_SEARCH_HIST, /* M-n */
F_UNASSIGNED, /* M-o */
F_UP_SEARCH_HIST, /* M-p */
F_UNASSIGNED, /* M-q */
F_TOGGLE_HIST, /* M-r */
F_CORRECT, /* M-s */
F_UNASSIGNED, /* M-t */
F_CASEUPPER, /* M-u */
F_UNASSIGNED, /* M-v */
F_COPYREGION, /* M-w */
F_UNASSIGNED, /* M-x */
F_YANK_POP, /* M-y */
F_UNASSIGNED, /* M-z */
F_UNASSIGNED, /* M-{ */
F_UNASSIGNED, /* M-| */
F_UNASSIGNED, /* M-} */
F_UNASSIGNED, /* M-~ */
F_DELWORDPREV /* M-^? */
};
/*
* keymap table for vi. Each index into above tbl; should be
* 256 entries long. Vi mode uses a sticky-extend to do command mode:
* insert mode characters are in the normal keymap, and command mode
* in the extended keymap.
*/
static KEYCMD CcViMap[] = {
#ifdef KSHVI
F_UNASSIGNED, /* ^@ */
F_INSERT, /* ^A */
F_INSERT, /* ^B */
F_INSERT, /* ^C */
F_INSERT, /* ^D */
F_INSERT, /* ^E */
F_INSERT, /* ^F */
F_INSERT, /* ^G */
V_DELPREV, /* ^H */ /* BackSpace key */
F_COMPLETE, /* ^I */ /* Tab Key */
F_NEWLINE, /* ^J */
F_INSERT, /* ^K */
F_INSERT, /* ^L */
F_NEWLINE, /* ^M */
F_INSERT, /* ^N */
F_INSERT, /* ^O */
F_INSERT, /* ^P */
F_TTY_STARTO, /* ^Q */
F_INSERT, /* ^R */
F_INSERT, /* ^S */
F_INSERT, /* ^T */
F_INSERT, /* ^U */
F_QUOTE, /* ^V */
F_DELWORDPREV, /* ^W */ /* Only until start edit pos */
F_INSERT, /* ^X */
F_INSERT, /* ^Y */
F_INSERT, /* ^Z */
V_CMD_MODE, /* ^[ */ /* [ Esc ] key */
F_TTY_QUIT, /* ^\ */
F_INSERT, /* ^] */
F_INSERT, /* ^^ */
F_INSERT, /* ^_ */
#else /* !KSHVI */
F_UNASSIGNED, /* ^@ */ /* NOTE: These mapping do NOT */
F_TOBEG, /* ^A */ /* Correspond well to the KSH */
F_CHARBACK, /* ^B */ /* VI editting assignments */
F_TTY_INT, /* ^C */ /* On the other hand they are */
F_LIST_EOF, /* ^D */ /* convenient any many people */
F_TOEND, /* ^E */ /* have gotten used to them */
F_CHARFWD, /* ^F */
F_LIST_GLOB, /* ^G */
F_DELPREV, /* ^H */ /* BackSpace key */
F_COMPLETE, /* ^I */ /* Tab Key */
F_NEWLINE, /* ^J */
F_KILLEND, /* ^K */
F_CLEARDISP, /* ^L */
F_NEWLINE, /* ^M */
F_DOWN_HIST, /* ^N */
F_TTY_FLUSHO, /* ^O */
F_UP_HIST, /* ^P */
F_TTY_STARTO, /* ^Q */
F_REDISP, /* ^R */
F_TTY_STOPO, /* ^S */
F_CHARSWITCH, /* ^T */
F_KILLBEG, /* ^U */
F_QUOTE, /* ^V */
F_DELWORDPREV, /* ^W */
F_EXPAND, /* ^X */
F_TTY_DSUSP, /* ^Y */
F_TTY_TSUSP, /* ^Z */
V_CMD_MODE, /* ^[ */
F_TTY_QUIT, /* ^\ */
F_UNASSIGNED, /* ^] */
F_UNASSIGNED, /* ^^ */
F_UNASSIGNED, /* ^_ */
#endif /* KSHVI */
F_INSERT, /* SPACE */
F_INSERT, /* ! */
F_INSERT, /* " */
F_INSERT, /* # */
F_INSERT, /* $ */
F_INSERT, /* % */
F_INSERT, /* & */
F_INSERT, /* ' */
F_INSERT, /* ( */
F_INSERT, /* ) */
F_INSERT, /* * */
F_INSERT, /* + */
F_INSERT, /* , */
F_INSERT, /* - */
F_INSERT, /* . */
F_INSERT, /* / */
F_INSERT, /* 0 */
F_INSERT, /* 1 */
F_INSERT, /* 2 */
F_INSERT, /* 3 */
F_INSERT, /* 4 */
F_INSERT, /* 5 */
F_INSERT, /* 6 */
F_INSERT, /* 7 */
F_INSERT, /* 8 */
F_INSERT, /* 9 */
F_INSERT, /* : */
F_INSERT, /* ; */
F_INSERT, /* < */
F_INSERT, /* = */
F_INSERT, /* > */
F_INSERT, /* ? */
F_INSERT, /* @ */
F_INSERT, /* A */
F_INSERT, /* B */
F_INSERT, /* C */
F_INSERT, /* D */
F_INSERT, /* E */
F_INSERT, /* F */
F_INSERT, /* G */
F_INSERT, /* H */
F_INSERT, /* I */
F_INSERT, /* J */
F_INSERT, /* K */
F_INSERT, /* L */
F_INSERT, /* M */
F_INSERT, /* N */
F_INSERT, /* O */
F_INSERT, /* P */
F_INSERT, /* Q */
F_INSERT, /* R */
F_INSERT, /* S */
F_INSERT, /* T */
F_INSERT, /* U */
F_INSERT, /* V */
F_INSERT, /* W */
F_INSERT, /* X */
F_INSERT, /* Y */
F_INSERT, /* Z */
F_INSERT, /* [ */
F_INSERT, /* \ */
F_INSERT, /* ] */
F_INSERT, /* ^ */
F_INSERT, /* _ */
F_INSERT, /* ` */
F_INSERT, /* a */
F_INSERT, /* b */
F_INSERT, /* c */
F_INSERT, /* d */
F_INSERT, /* e */
F_INSERT, /* f */
F_INSERT, /* g */
F_INSERT, /* h */
F_INSERT, /* i */
F_INSERT, /* j */
F_INSERT, /* k */
F_INSERT, /* l */
F_INSERT, /* m */
F_INSERT, /* n */
F_INSERT, /* o */
F_INSERT, /* p */
F_INSERT, /* q */
F_INSERT, /* r */
F_INSERT, /* s */
F_INSERT, /* t */
F_INSERT, /* u */
F_INSERT, /* v */
F_INSERT, /* w */
F_INSERT, /* x */
F_INSERT, /* y */
F_INSERT, /* z */
F_INSERT, /* { */
F_INSERT, /* | */
F_INSERT, /* } */
F_INSERT, /* ~ */
F_DELPREV, /* ^? */
F_UNASSIGNED, /* M-^@ */
F_UNASSIGNED, /* M-^A */
F_UNASSIGNED, /* M-^B */
F_UNASSIGNED, /* M-^C */
F_UNASSIGNED, /* M-^D */
F_UNASSIGNED, /* M-^E */
F_UNASSIGNED, /* M-^F */
F_UNASSIGNED, /* M-^G */
F_UNASSIGNED, /* M-^H */
F_UNASSIGNED, /* M-^I */
F_UNASSIGNED, /* M-^J */
F_UNASSIGNED, /* M-^K */
F_UNASSIGNED, /* M-^L */
F_UNASSIGNED, /* M-^M */
F_UNASSIGNED, /* M-^N */
F_UNASSIGNED, /* M-^O */
F_UNASSIGNED, /* M-^P */
F_UNASSIGNED, /* M-^Q */
F_UNASSIGNED, /* M-^R */
F_UNASSIGNED, /* M-^S */
F_UNASSIGNED, /* M-^T */
F_UNASSIGNED, /* M-^U */
F_UNASSIGNED, /* M-^V */
F_UNASSIGNED, /* M-^W */
F_UNASSIGNED, /* M-^X */
F_UNASSIGNED, /* M-^Y */
F_UNASSIGNED, /* M-^Z */
F_UNASSIGNED, /* M-^[ */
F_UNASSIGNED, /* M-^\ */
F_UNASSIGNED, /* M-^] */
F_UNASSIGNED, /* M-^^ */
F_UNASSIGNED, /* M-^_ */
F_UNASSIGNED, /* M-SPACE */
F_UNASSIGNED, /* M-! */
F_UNASSIGNED, /* M-" */
F_UNASSIGNED, /* M-# */
F_UNASSIGNED, /* M-$ */
F_UNASSIGNED, /* M-% */
F_UNASSIGNED, /* M-& */
F_UNASSIGNED, /* M-' */
F_UNASSIGNED, /* M-( */
F_UNASSIGNED, /* M-) */
F_UNASSIGNED, /* M-* */
F_UNASSIGNED, /* M-+ */
F_UNASSIGNED, /* M-, */
F_UNASSIGNED, /* M-- */
F_UNASSIGNED, /* M-. */
F_UNASSIGNED, /* M-/ */
F_UNASSIGNED, /* M-0 */
F_UNASSIGNED, /* M-1 */
F_UNASSIGNED, /* M-2 */
F_UNASSIGNED, /* M-3 */
F_UNASSIGNED, /* M-4 */
F_UNASSIGNED, /* M-5 */
F_UNASSIGNED, /* M-6 */
F_UNASSIGNED, /* M-7 */
F_UNASSIGNED, /* M-8 */
F_UNASSIGNED, /* M-9 */
F_UNASSIGNED, /* M-: */
F_UNASSIGNED, /* M-; */
F_UNASSIGNED, /* M-< */
F_UNASSIGNED, /* M-= */
F_UNASSIGNED, /* M-> */
F_UNASSIGNED, /* M-? */
F_UNASSIGNED, /* M-@ */
F_UNASSIGNED, /* M-A */
F_UNASSIGNED, /* M-B */
F_UNASSIGNED, /* M-C */
F_UNASSIGNED, /* M-D */
F_UNASSIGNED, /* M-E */
F_UNASSIGNED, /* M-F */
F_UNASSIGNED, /* M-G */
F_UNASSIGNED, /* M-H */
F_UNASSIGNED, /* M-I */
F_UNASSIGNED, /* M-J */
F_UNASSIGNED, /* M-K */
F_UNASSIGNED, /* M-L */
F_UNASSIGNED, /* M-M */
F_UNASSIGNED, /* M-N */
F_UNASSIGNED, /* M-O */
F_UNASSIGNED, /* M-P */
F_UNASSIGNED, /* M-Q */
F_UNASSIGNED, /* M-R */
F_UNASSIGNED, /* M-S */
F_UNASSIGNED, /* M-T */
F_UNASSIGNED, /* M-U */
F_UNASSIGNED, /* M-V */
F_UNASSIGNED, /* M-W */
F_UNASSIGNED, /* M-X */
F_UNASSIGNED, /* M-Y */
F_UNASSIGNED, /* M-Z */
F_UNASSIGNED, /* M-[ */
F_UNASSIGNED, /* M-\ */
F_UNASSIGNED, /* M-] */
F_UNASSIGNED, /* M-^ */
F_UNASSIGNED, /* M-_ */
F_UNASSIGNED, /* M-` */
F_UNASSIGNED, /* M-a */
F_UNASSIGNED, /* M-b */
F_UNASSIGNED, /* M-c */
F_UNASSIGNED, /* M-d */
F_UNASSIGNED, /* M-e */
F_UNASSIGNED, /* M-f */
F_UNASSIGNED, /* M-g */
F_UNASSIGNED, /* M-h */
F_UNASSIGNED, /* M-i */
F_UNASSIGNED, /* M-j */
F_UNASSIGNED, /* M-k */
F_UNASSIGNED, /* M-l */
F_UNASSIGNED, /* M-m */
F_UNASSIGNED, /* M-n */
F_UNASSIGNED, /* M-o */
F_UNASSIGNED, /* M-p */
F_UNASSIGNED, /* M-q */
F_UNASSIGNED, /* M-r */
F_UNASSIGNED, /* M-s */
F_UNASSIGNED, /* M-t */
F_UNASSIGNED, /* M-u */
F_UNASSIGNED, /* M-v */
F_UNASSIGNED, /* M-w */
F_UNASSIGNED, /* M-x */
F_UNASSIGNED, /* M-y */
F_UNASSIGNED, /* M-z */
F_UNASSIGNED, /* M-{ */
F_UNASSIGNED, /* M-| */
F_UNASSIGNED, /* M-} */
F_UNASSIGNED, /* M-~ */
F_UNASSIGNED /* M-^? */
};
KEYCMD CcViCmdMap[] = {
F_UNASSIGNED, /* ^@ */
F_TOBEG, /* ^A */
F_UNASSIGNED, /* ^B */
F_TTY_INT, /* ^C */
F_LIST_CHOICES, /* ^D */
F_TOEND, /* ^E */
F_UNASSIGNED, /* ^F */
F_LIST_GLOB, /* ^G */
F_CHARBACK, /* ^H */
V_CM_COMPLETE, /* ^I */
F_NEWLINE, /* ^J */
F_KILLEND, /* ^K */
F_CLEARDISP, /* ^L */
F_NEWLINE, /* ^M */
F_DOWN_HIST, /* ^N */
F_TTY_FLUSHO, /* ^O */
F_UP_HIST, /* ^P */
F_TTY_STARTO, /* ^Q */
F_REDISP, /* ^R */
F_TTY_STOPO, /* ^S */
F_UNASSIGNED, /* ^T */
F_KILLBEG, /* ^U */
F_UNASSIGNED, /* ^V */
F_DELWORDPREV, /* ^W */
F_EXPAND, /* ^X */
F_UNASSIGNED, /* ^Y */
F_UNASSIGNED, /* ^Z */
F_METANEXT, /* ^[ */
F_TTY_QUIT, /* ^\ */
F_UNASSIGNED, /* ^] */
F_UNASSIGNED, /* ^^ */
F_UNASSIGNED, /* ^_ */
F_CHARFWD, /* SPACE */
F_EXPAND_HISTORY, /* ! */
F_UNASSIGNED, /* " */
F_UNASSIGNED, /* # */
F_TOEND, /* $ */
F_UNASSIGNED, /* % */
F_UNASSIGNED, /* & */
F_UNASSIGNED, /* ' */
F_UNASSIGNED, /* ( */
F_UNASSIGNED, /* ) */
F_EXPAND_GLOB, /* * */
F_DOWN_HIST, /* + */
V_RCHAR_BACK, /* , */
F_UP_HIST, /* - */
F_UNASSIGNED, /* . */
V_DSH_META, /* / */
V_ZERO, /* 0 */
F_ARGDIGIT, /* 1 */
F_ARGDIGIT, /* 2 */
F_ARGDIGIT, /* 3 */
F_ARGDIGIT, /* 4 */
F_ARGDIGIT, /* 5 */
F_ARGDIGIT, /* 6 */
F_ARGDIGIT, /* 7 */
F_ARGDIGIT, /* 8 */
F_ARGDIGIT, /* 9 */
F_UNASSIGNED, /* : */
V_RCHAR_FWD, /* ; */
F_UNASSIGNED, /* < */
F_UNASSIGNED, /* = */
F_UNASSIGNED, /* > */
V_USH_META, /* ? */
F_UNASSIGNED, /* @ */
V_ADDEND, /* A */
V_WORDBACK, /* B */
V_CHGTOEND, /* C */
F_KILLEND, /* D */
V_ENDWORD, /* E */
V_CHAR_BACK, /* F */
F_UNASSIGNED, /* G */
F_UNASSIGNED, /* H */
V_INSBEG, /* I */
F_DOWN_SEARCH_HIST, /* J */
F_UP_SEARCH_HIST, /* K */
F_UNASSIGNED, /* L */
F_UNASSIGNED, /* M */
V_RSRCH_BACK, /* N */
F_XKEY, /* O */
F_UNASSIGNED, /* P */
F_UNASSIGNED, /* Q */
V_REPLMODE, /* R */
V_SUBSTLINE, /* S */
V_CHARTO_BACK, /* T */
F_UNASSIGNED, /* U */
F_EXPAND_VARS, /* V */
V_WORDFWD, /* W */
F_DELPREV, /* X */
F_UNASSIGNED, /* Y */
F_UNASSIGNED, /* Z */
F_XKEY, /* [ */
F_UNASSIGNED, /* \ */
F_UNASSIGNED, /* ] */
F_TOBEG, /* ^ */
F_UNASSIGNED, /* _ */
F_UNASSIGNED, /* ` */
V_ADD, /* a */
F_WORDBACK, /* b */
V_CHGMETA, /* c */
V_DELMETA, /* d */
V_EWORD, /* e */
V_CHAR_FWD, /* f */
F_UNASSIGNED, /* g */
F_CHARBACK, /* h */
V_INSERT, /* i */
F_DOWN_HIST, /* j */
F_UP_HIST, /* k */
F_CHARFWD, /* l */
F_UNASSIGNED, /* m */
V_RSRCH_FWD, /* n */
F_UNASSIGNED, /* o */
F_UNASSIGNED, /* p */
F_UNASSIGNED, /* q */
V_REPLONE, /* r */
V_SUBSTCHAR, /* s */
V_CHARTO_FWD, /* t */
V_UNDO, /* u */
F_EXPAND_VARS, /* v */
V_WORDBEGNEXT, /* w */
F_DELNEXT_EOF, /* x */
F_UNASSIGNED, /* y */
F_UNASSIGNED, /* z */
F_UNASSIGNED, /* { */
F_UNASSIGNED, /* | */
F_UNASSIGNED, /* } */
V_CHGCASE, /* ~ */
F_DELPREV, /* ^? */
F_UNASSIGNED, /* M-^@ */
F_UNASSIGNED, /* M-^A */
F_UNASSIGNED, /* M-^B */
F_UNASSIGNED, /* M-^C */
F_UNASSIGNED, /* M-^D */
F_UNASSIGNED, /* M-^E */
F_UNASSIGNED, /* M-^F */
F_UNASSIGNED, /* M-^G */
F_UNASSIGNED, /* M-^H */
F_UNASSIGNED, /* M-^I */
F_UNASSIGNED, /* M-^J */