1: /* 2: * ed.defns.c: Editor function definitions and initialization 3: */ 4: /*- 5: * Copyright (c) 1980, 1991 The Regents of the University of California. 6: * All rights reserved. 7: * 8: * Redistribution and use in source and binary forms, with or without 9: * modification, are permitted provided that the following conditions 10: * are met: 11: * 1. Redistributions of source code must retain the above copyright 12: * notice, this list of conditions and the following disclaimer. 13: * 2. Redistributions in binary form must reproduce the above copyright 14: * notice, this list of conditions and the following disclaimer in the 15: * documentation and/or other materials provided with the distribution. 16: * 3. All advertising materials mentioning features or use of this software 17: * must display the following acknowledgement: 18: * This product includes software developed by the University of 19: * California, Berkeley and its contributors. 20: * 4. Neither the name of the University nor the names of its contributors 21: * may be used to endorse or promote products derived from this software 22: * without specific prior written permission. 23: * 24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34: * SUCH DAMAGE. 35: */ 36: #include "config.h" 37: #if !defined(lint) && !defined(pdp11) 38: static char *rcsid() 39: { return "$Id: ed.defns.c,v 3.0.1 1996/04/04 21:49:28 sms Exp $"; } 40: #endif 41: 42: #include "sh.h" 43: #include "ed.h" 44: 45: extern CCRETVAL e_unassigned __P((void)); 46: extern CCRETVAL e_insert __P((void)); 47: extern CCRETVAL e_newline __P((void)); 48: extern CCRETVAL e_delprev __P((void)); 49: extern CCRETVAL e_delnext __P((void)); 50: extern CCRETVAL e_l_delnext __P((void)); /* for ^D */ 51: extern CCRETVAL e_toend __P((void)); 52: extern CCRETVAL e_tobeg __P((void)); 53: extern CCRETVAL e_charback __P((void)); 54: extern CCRETVAL e_charfwd __P((void)); 55: extern CCRETVAL e_quote __P((void)); 56: extern CCRETVAL e_startover __P((void)); 57: extern CCRETVAL e_redisp __P((void)); 58: extern CCRETVAL e_wordback __P((void)); 59: extern CCRETVAL e_wordfwd __P((void)); 60: extern CCRETVAL v_wordbegnext __P((void)); 61: extern CCRETVAL e_uppercase __P((void)); 62: extern CCRETVAL e_lowercase __P((void)); 63: extern CCRETVAL e_capitolcase __P((void)); 64: extern CCRETVAL e_cleardisp __P((void)); 65: extern CCRETVAL e_complete __P((void)); 66: extern CCRETVAL e_corr __P((void)); 67: extern CCRETVAL e_corrl __P((void)); 68: extern CCRETVAL e_up_hist __P((void)); 69: extern CCRETVAL e_d_hist __P((void)); 70: extern CCRETVAL e_up_search_hist __P((void)); 71: extern CCRETVAL e_d_search_hist __P((void)); 72: extern CCRETVAL e_helpme __P((void)); 73: extern CCRETVAL e_l_choices __P((void)); 74: extern CCRETVAL e_dwrdprev __P((void)); 75: extern CCRETVAL e_dwrdnext __P((void)); 76: extern CCRETVAL e_digit __P((void)); 77: extern CCRETVAL e_argdigit __P((void)); 78: extern CCRETVAL v_zero __P((void)); 79: extern CCRETVAL e_killend __P((void)); 80: extern CCRETVAL e_killbeg __P((void)); 81: extern CCRETVAL e_metanext __P((void)); 82: #ifdef notdef 83: extern CCRETVAL e_extendnext __P((void)); 84: #endif 85: extern CCRETVAL e_send_eof __P((void)); 86: extern CCRETVAL e_charswitch __P((void)); 87: extern CCRETVAL e_gcharswitch __P((void)); 88: extern CCRETVAL e_which __P((void)); 89: extern CCRETVAL e_yank_kill __P((void)); 90: extern CCRETVAL e_t_dsusp __P((void)); 91: extern CCRETVAL e_t_flusho __P((void)); 92: extern CCRETVAL e_t_quit __P((void)); 93: extern CCRETVAL e_t_tsusp __P((void)); 94: extern CCRETVAL e_t_stopo __P((void)); 95: extern CCRETVAL e_t_starto __P((void)); 96: extern CCRETVAL e_argfour __P((void)); 97: extern CCRETVAL e_set_mark __P((void)); 98: extern CCRETVAL e_exchange_mark __P((void)); 99: extern CCRETVAL e_last_item __P((void)); 100: extern CCRETVAL v_cmd_mode __P((void)); 101: extern CCRETVAL v_insert __P((void)); 102: extern CCRETVAL v_replmode __P((void)); 103: extern CCRETVAL v_replone __P((void)); 104: extern CCRETVAL v_s_line __P((void)); 105: extern CCRETVAL v_s_char __P((void)); 106: extern CCRETVAL v_add __P((void)); 107: extern CCRETVAL v_addend __P((void)); 108: extern CCRETVAL v_insbeg __P((void)); 109: extern CCRETVAL v_chgtoend __P((void)); 110: extern CCRETVAL e_killregion __P((void)); 111: extern CCRETVAL e_killall __P((void)); 112: extern CCRETVAL e_copyregion __P((void)); 113: extern CCRETVAL e_t_int __P((void)); 114: extern CCRETVAL e_run_fg_editor __P((void)); 115: extern CCRETVAL e_l_eof __P((void)); 116: extern CCRETVAL e_ex_history __P((void)); 117: extern CCRETVAL e_magic_space __P((void)); 118: extern CCRETVAL e_l_glob __P((void)); 119: extern CCRETVAL e_ex_glob __P((void)); 120: extern CCRETVAL e_insovr __P((void)); 121: extern CCRETVAL v_cm_complete __P((void)); 122: extern CCRETVAL e_copyprev __P((void)); 123: extern CCRETVAL v_change_case __P((void)); 124: extern CCRETVAL e_expand __P((void)); 125: extern CCRETVAL e_ex_vars __P((void)); 126: extern CCRETVAL e_toggle_hist __P((void)); 127: 128: 129: static void ed_IMetaBindings __P((void)); 130: 131: PFCmd CcFuncTbl[] = { /* table of available commands */ 132: e_unassigned, 133: /* no #define here -- this is a dummy to detect initing of the key map */ 134: e_unassigned, 135: #define F_UNASSIGNED 1 136: e_insert, 137: #define F_INSERT 2 138: e_newline, 139: #define F_NEWLINE 3 140: e_delprev, 141: #define F_DELPREV 4 142: e_delnext, 143: #define F_DELNEXT 5 144: e_toend, 145: #define F_TOEND 6 146: e_tobeg, 147: #define F_TOBEG 7 148: e_charback, 149: #define F_CHARBACK 8 150: e_charfwd, 151: #define F_CHARFWD 9 152: e_quote, 153: #define F_QUOTE 10 154: e_startover, 155: #define F_STARTOVER 11 156: e_redisp, 157: #define F_REDISP 12 158: e_t_int, 159: #define F_TTY_INT 13 160: e_wordback, 161: #define F_WORDBACK 14 162: e_wordfwd, 163: #define F_WORDFWD 15 164: e_cleardisp, 165: #define F_CLEARDISP 16 166: e_complete, 167: #define F_COMPLETE 17 168: e_corr, 169: #define F_CORRECT 18 170: e_up_hist, 171: #define F_UP_HIST 19 172: e_d_hist, 173: #define F_DOWN_HIST 20 174: e_up_search_hist, 175: #define F_UP_SEARCH_HIST 21 176: e_d_search_hist, 177: #define F_DOWN_SEARCH_HIST 22 178: e_helpme, 179: #define F_HELPME 23 180: e_l_choices, 181: #define F_LIST_CHOICES 24 182: e_dwrdprev, 183: #define F_DELWORDPREV 25 184: e_dwrdnext, 185: #define F_DELWORDNEXT 26 186: e_digit, 187: #define F_DIGIT 27 188: e_killend, 189: #define F_KILLEND 28 190: e_killbeg, 191: #define F_KILLBEG 29 192: e_metanext, 193: #define F_METANEXT 30 194: e_send_eof, 195: #define F_SEND_EOF 31 196: e_charswitch, 197: #define F_CHARSWITCH 32 198: e_which, 199: #define F_WHICH 33 200: e_yank_kill, 201: #define F_YANK_KILL 34 202: e_t_dsusp, 203: #define F_TTY_DSUSP 35 204: e_t_flusho, 205: #define F_TTY_FLUSHO 36 206: e_t_quit, 207: #define F_TTY_QUIT 37 208: e_t_tsusp, 209: #define F_TTY_TSUSP 38 210: e_t_stopo, 211: #define F_TTY_STOPO 39 212: e_t_starto, 213: #define F_TTY_STARTO 40 214: e_argfour, 215: #define F_ARGFOUR 41 216: e_set_mark, 217: #define F_SET_MARK 42 218: e_exchange_mark, 219: #define F_EXCHANGE_MARK 43 220: e_last_item, 221: #define F_LAST_ITEM 44 222: e_l_delnext, 223: #define F_LIST_DELNEXT 45 224: v_cmd_mode, 225: #define V_CMD_MODE 46 226: v_insert, 227: #define V_INSERT 47 228: e_argdigit, 229: #define F_ARGDIGIT 48 230: e_killregion, 231: #define F_KILLREGION 49 232: e_copyregion, 233: #define F_COPYREGION 50 234: e_gcharswitch, 235: #define F_GCHARSWITCH 51 236: e_run_fg_editor, 237: #define F_RUN_FG_EDITOR 52 238: e_unassigned, /* place holder for sequence lead in character */ 239: #define F_XKEY 53 240: e_uppercase, 241: #define F_CASEUPPER 54 242: e_lowercase, 243: #define F_CASELOWER 55 244: e_capitolcase, 245: #define F_CASECAPITAL 56 246: v_zero, 247: #define V_ZERO 57 248: v_add, 249: #define V_ADD 58 250: v_addend, 251: #define V_ADDEND 59 252: v_wordbegnext, 253: #define V_WORDBEGNEXT 60 254: e_killall, 255: #define F_KILLALL 61 256: e_unassigned, 257: /* F_EXTENDNEXT removed */ 258: v_insbeg, 259: #define V_INSBEG 63 260: v_replmode, 261: #define V_REPLMODE 64 262: v_replone, 263: #define V_REPLONE 65 264: v_s_line, 265: #define V_SUBSTLINE 66 266: v_s_char, 267: #define V_SUBSTCHAR 67 268: v_chgtoend, 269: #define V_CHGTOEND 68 270: e_l_eof, 271: #define F_LIST_EOF 69 272: e_l_glob, 273: #define F_LIST_GLOB 70 274: e_ex_history, 275: #define F_EXPAND_HISTORY 71 276: e_magic_space, 277: #define F_MAGIC_SPACE 72 278: e_insovr, 279: #define F_INSOVR 73 280: v_cm_complete, 281: #define V_CM_COMPLETE 74 282: e_copyprev, 283: #define F_COPYPREV 75 284: e_corrl, 285: #define F_CORRECT_L 76 286: e_ex_glob, 287: #define F_EXPAND_GLOB 77 288: e_ex_vars, 289: #define F_EXPAND_VARS 78 290: e_toggle_hist, 291: #define F_TOGGLE_HIST 79 292: v_change_case, 293: #define V_CHGCASE 80 294: e_expand, 295: #define F_EXPAND 81 296: 0 /* DUMMY VALUE */ 297: #define F_NUM_FNS 82 298: }; 299: 300: KEYCMD NumFuns = F_NUM_FNS; 301: 302: KEYCMD CcKeyMap[256]; /* the real key map */ 303: KEYCMD CcAltMap[256]; /* the alternative key map */ 304: 305: KEYCMD CcEmacsMap[] = { 306: /* keymap table, each index into above tbl; should be 256*sizeof(KEYCMD) 307: bytes long */ 308: 309: F_SET_MARK, /* ^@ */ 310: F_TOBEG, /* ^A */ 311: F_CHARBACK, /* ^B */ 312: F_TTY_INT, /* ^C */ 313: F_LIST_DELNEXT, /* ^D */ 314: F_TOEND, /* ^E */ 315: F_CHARFWD, /* ^F */ 316: F_UNASSIGNED, /* ^G */ 317: F_DELPREV, /* ^H */ 318: F_COMPLETE, /* ^I */ 319: F_NEWLINE, /* ^J */ 320: F_KILLEND, /* ^K */ 321: F_CLEARDISP, /* ^L */ 322: F_NEWLINE, /* ^M */ 323: F_DOWN_HIST, /* ^N */ 324: F_TTY_FLUSHO, /* ^O */ 325: F_UP_HIST, /* ^P */ 326: F_TTY_STARTO, /* ^Q */ 327: F_REDISP, /* ^R */ 328: F_TTY_STOPO, /* ^S */ 329: F_CHARSWITCH, /* ^T */ 330: F_KILLALL, /* ^U */ 331: F_QUOTE, /* ^V */ 332: F_KILLREGION, /* ^W */ 333: F_XKEY, /* ^X */ 334: F_YANK_KILL, /* ^Y */ 335: F_TTY_TSUSP, /* ^Z */ 336: F_METANEXT, /* ^[ */ 337: F_TTY_QUIT, /* ^\ */ 338: F_TTY_DSUSP, /* ^] */ 339: F_UNASSIGNED, /* ^^ */ 340: F_UNASSIGNED, /* ^_ */ 341: F_INSERT, /* SPACE */ 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_INSERT, /* * */ 352: F_INSERT, /* + */ 353: F_INSERT, /* , */ 354: F_INSERT, /* - */ 355: F_INSERT, /* . */ 356: F_INSERT, /* / */ 357: F_DIGIT, /* 0 */ 358: F_DIGIT, /* 1 */ 359: F_DIGIT, /* 2 */ 360: F_DIGIT, /* 3 */ 361: F_DIGIT, /* 4 */ 362: F_DIGIT, /* 5 */ 363: F_DIGIT, /* 6 */ 364: F_DIGIT, /* 7 */ 365: F_DIGIT, /* 8 */ 366: F_DIGIT, /* 9 */ 367: F_INSERT, /* : */ 368: F_INSERT, /* ; */ 369: F_INSERT, /* < */ 370: F_INSERT, /* = */ 371: F_INSERT, /* > */ 372: F_INSERT, /* ? */ 373: F_INSERT, /* @ */ 374: F_INSERT, /* A */ 375: F_INSERT, /* B */ 376: F_INSERT, /* C */ 377: F_INSERT, /* D */ 378: F_INSERT, /* E */ 379: F_INSERT, /* F */ 380: F_INSERT, /* G */ 381: F_INSERT, /* H */ 382: F_INSERT, /* I */ 383: F_INSERT, /* J */ 384: F_INSERT, /* K */ 385: F_INSERT, /* L */ 386: F_INSERT, /* M */ 387: F_INSERT, /* N */ 388: F_INSERT, /* O */ 389: F_INSERT, /* P */ 390: F_INSERT, /* Q */ 391: F_INSERT, /* R */ 392: F_INSERT, /* S */ 393: F_INSERT, /* T */ 394: F_INSERT, /* U */ 395: F_INSERT, /* V */ 396: F_INSERT, /* W */ 397: F_INSERT, /* X */ 398: F_INSERT, /* Y */ 399: F_INSERT, /* Z */ 400: F_INSERT, /* [ */ 401: F_INSERT, /* \ */ 402: F_INSERT, /* ] */ 403: F_INSERT, /* ^ */ 404: F_INSERT, /* _ */ 405: F_INSERT, /* ` */ 406: F_INSERT, /* a */ 407: F_INSERT, /* b */ 408: F_INSERT, /* c */ 409: F_INSERT, /* d */ 410: F_INSERT, /* e */ 411: F_INSERT, /* f */ 412: F_INSERT, /* g */ 413: F_INSERT, /* h */ 414: F_INSERT, /* i */ 415: F_INSERT, /* j */ 416: F_INSERT, /* k */ 417: F_INSERT, /* l */ 418: F_INSERT, /* m */ 419: F_INSERT, /* n */ 420: F_INSERT, /* o */ 421: F_INSERT, /* p */ 422: F_INSERT, /* q */ 423: F_INSERT, /* r */ 424: F_INSERT, /* s */ 425: F_INSERT, /* t */ 426: F_INSERT, /* u */ 427: F_INSERT, /* v */ 428: F_INSERT, /* w */ 429: F_INSERT, /* x */ 430: F_INSERT, /* y */ 431: F_INSERT, /* z */ 432: F_INSERT, /* { */ 433: F_INSERT, /* | */ 434: F_INSERT, /* } */ 435: F_INSERT, /* ~ */ 436: F_DELPREV, /* ^? */ 437: F_UNASSIGNED, /* M-^@ */ 438: F_UNASSIGNED, /* M-^A */ 439: F_UNASSIGNED, /* M-^B */ 440: F_UNASSIGNED, /* M-^C */ 441: F_LIST_CHOICES, /* M-^D */ 442: F_UNASSIGNED, /* M-^E */ 443: F_UNASSIGNED, /* M-^F */ 444: F_UNASSIGNED, /* M-^G */ 445: F_DELWORDPREV, /* M-^H */ 446: F_COMPLETE, /* M-^I */ 447: F_UNASSIGNED, /* M-^J */ 448: F_UNASSIGNED, /* M-^K */ 449: F_CLEARDISP, /* M-^L */ 450: F_UNASSIGNED, /* M-^M */ 451: F_UNASSIGNED, /* M-^N */ 452: F_UNASSIGNED, /* M-^O */ 453: F_UNASSIGNED, /* M-^P */ 454: F_UNASSIGNED, /* M-^Q */ 455: F_UNASSIGNED, /* M-^R */ 456: F_UNASSIGNED, /* M-^S */ 457: F_UNASSIGNED, /* M-^T */ 458: F_UNASSIGNED, /* M-^U */ 459: F_UNASSIGNED, /* M-^V */ 460: F_UNASSIGNED, /* M-^W */ 461: F_UNASSIGNED, /* M-^X */ 462: F_UNASSIGNED, /* M-^Y */ 463: F_RUN_FG_EDITOR, /* M-^Z */ 464: F_COMPLETE, /* M-^[ */ 465: F_UNASSIGNED, /* M-^\ */ 466: F_UNASSIGNED, /* M-^] */ 467: F_UNASSIGNED, /* M-^^ */ 468: F_COPYPREV, /* M-^_ */ 469: F_EXPAND_HISTORY, /* M-SPACE */ 470: F_EXPAND_HISTORY, /* M-! */ 471: F_UNASSIGNED, /* M-" */ 472: F_UNASSIGNED, /* M-# */ 473: F_CORRECT_L, /* M-$ */ 474: F_UNASSIGNED, /* M-% */ 475: F_UNASSIGNED, /* M-& */ 476: F_UNASSIGNED, /* M-' */ 477: F_UNASSIGNED, /* M-( */ 478: F_UNASSIGNED, /* M-) */ 479: F_UNASSIGNED, /* M-* */ 480: F_UNASSIGNED, /* M-+ */ 481: F_UNASSIGNED, /* M-, */ 482: F_UNASSIGNED, /* M-- */ 483: F_UNASSIGNED, /* M-. */ 484: F_UNASSIGNED, /* M-/ */ 485: F_ARGDIGIT, /* M-0 */ 486: F_ARGDIGIT, /* M-1 */ 487: F_ARGDIGIT, /* M-2 */ 488: F_ARGDIGIT, /* M-3 */ 489: F_ARGDIGIT, /* M-4 */ 490: F_ARGDIGIT, /* M-5 */ 491: F_ARGDIGIT, /* M-6 */ 492: F_ARGDIGIT, /* M-7 */ 493: F_ARGDIGIT, /* M-8 */ 494: F_ARGDIGIT, /* M-9 */ 495: F_UNASSIGNED, /* M-: */ 496: F_UNASSIGNED, /* M-; */ 497: F_UNASSIGNED, /* M-< */ 498: F_UNASSIGNED, /* M-= */ 499: F_UNASSIGNED, /* M-> */ 500: F_WHICH, /* M-? */ 501: F_UNASSIGNED, /* M-@ */ 502: F_UNASSIGNED, /* M-A */ 503: F_WORDBACK, /* M-B */ 504: F_CASECAPITAL, /* M-C */ 505: F_DELWORDNEXT, /* M-D */ 506: F_UNASSIGNED, /* M-E */ 507: F_WORDFWD, /* M-F */ 508: F_UNASSIGNED, /* M-G */ 509: F_HELPME, /* M-H */ 510: F_UNASSIGNED, /* M-I */ 511: F_UNASSIGNED, /* M-J */ 512: F_UNASSIGNED, /* M-K */ 513: F_CASELOWER, /* M-L */ 514: F_UNASSIGNED, /* M-M */ 515: F_DOWN_SEARCH_HIST, /* M-N */ 516: F_XKEY, /* M-O *//* extended key esc PWP Mar 88 */ 517: F_UP_SEARCH_HIST, /* M-P */ 518: F_UNASSIGNED, /* M-Q */ 519: F_TOGGLE_HIST, /* M-R */ 520: F_CORRECT, /* M-S */ 521: F_UNASSIGNED, /* M-T */ 522: F_CASEUPPER, /* M-U */ 523: F_UNASSIGNED, /* M-V */ 524: F_COPYREGION, /* M-W */ 525: F_UNASSIGNED, /* M-X */ 526: F_UNASSIGNED, /* M-Y */ 527: F_UNASSIGNED, /* M-Z */ 528: F_XKEY, /* M-[ *//* extended key esc -mf Oct 87 */ 529: F_UNASSIGNED, /* M-\ */ 530: F_UNASSIGNED, /* M-] */ 531: F_UNASSIGNED, /* M-^ */ 532: F_LAST_ITEM, /* M-_ */ 533: F_UNASSIGNED, /* M-` */ 534: F_UNASSIGNED, /* M-a */ 535: F_WORDBACK, /* M-b */ 536: F_CASECAPITAL, /* M-c */ 537: F_DELWORDNEXT, /* M-d */ 538: F_UNASSIGNED, /* M-e */ 539: F_WORDFWD, /* M-f */ 540: F_UNASSIGNED, /* M-g */ 541: F_HELPME, /* M-h */ 542: F_UNASSIGNED, /* M-i */ 543: F_UNASSIGNED, /* M-j */ 544: F_UNASSIGNED, /* M-k */ 545: F_CASELOWER, /* M-l */ 546: F_UNASSIGNED, /* M-m */ 547: F_DOWN_SEARCH_HIST, /* M-n */ 548: F_UNASSIGNED, /* M-o */ 549: F_UP_SEARCH_HIST, /* M-p */ 550: F_UNASSIGNED, /* M-q */ 551: F_TOGGLE_HIST, /* M-r */ 552: F_CORRECT, /* M-s */ 553: F_UNASSIGNED, /* M-t */ 554: F_CASEUPPER, /* M-u */ 555: F_UNASSIGNED, /* M-v */ 556: F_COPYREGION, /* M-w */ 557: F_UNASSIGNED, /* M-x */ 558: F_UNASSIGNED, /* M-y */ 559: F_UNASSIGNED, /* M-z */ 560: F_UNASSIGNED, /* M-{ */ 561: F_UNASSIGNED, /* M-| */ 562: F_UNASSIGNED, /* M-} */ 563: F_UNASSIGNED, /* M-~ */ 564: F_DELWORDPREV /* M-^? */ 565: }; 566: 567: /* 568: * keymap table for vi. Each index into above tbl; should be 569: * 256 entries long. Vi mode uses a sticky-extend to do command mode: 570: * insert mode characters are in the normal keymap, and command mode 571: * in the extended keymap. 572: */ 573: KEYCMD CcViMap[] = { 574: F_UNASSIGNED, /* ^@ */ 575: F_TOBEG, /* ^A */ 576: F_CHARBACK, /* ^B */ 577: F_TTY_INT, /* ^C */ 578: F_LIST_EOF, /* ^D */ 579: F_TOEND, /* ^E */ 580: F_CHARFWD, /* ^F */ 581: F_LIST_GLOB, /* ^G */ 582: F_DELPREV, /* ^H */ 583: F_COMPLETE, /* ^I */ 584: F_NEWLINE, /* ^J */ 585: F_KILLEND, /* ^K */ 586: F_CLEARDISP, /* ^L */ 587: F_NEWLINE, /* ^M */ 588: F_DOWN_HIST, /* ^N */ 589: F_TTY_FLUSHO, /* ^O */ 590: F_UP_HIST, /* ^P */ 591: F_TTY_STARTO, /* ^Q */ 592: F_REDISP, /* ^R */ 593: F_TTY_STOPO, /* ^S */ 594: F_CHARSWITCH, /* ^T */ 595: F_KILLBEG, /* ^U */ 596: F_QUOTE, /* ^V */ 597: F_DELWORDPREV, /* ^W */ 598: F_EXPAND, /* ^X */ 599: F_TTY_DSUSP, /* ^Y */ 600: F_TTY_TSUSP, /* ^Z */ 601: V_CMD_MODE, /* ^[ */ 602: F_TTY_QUIT, /* ^\ */ 603: F_UNASSIGNED, /* ^] */ 604: F_UNASSIGNED, /* ^^ */ 605: F_UNASSIGNED, /* ^_ */ 606: F_INSERT, /* SPACE */ 607: F_INSERT, /* ! */ 608: F_INSERT, /* " */ 609: F_INSERT, /* # */ 610: F_INSERT, /* $ */ 611: F_INSERT, /* % */ 612: F_INSERT, /* & */ 613: F_INSERT, /* ' */ 614: F_INSERT, /* ( */ 615: F_INSERT, /* ) */ 616: F_INSERT, /* * */ 617: F_INSERT, /* + */ 618: F_INSERT, /* , */ 619: F_INSERT, /* - */ 620: F_INSERT, /* . */ 621: F_INSERT, /* / */ 622: F_INSERT, /* 0 */ 623: F_INSERT, /* 1 */ 624: F_INSERT, /* 2 */ 625: F_INSERT, /* 3 */ 626: F_INSERT, /* 4 */ 627: F_INSERT, /* 5 */ 628: F_INSERT, /* 6 */ 629: F_INSERT, /* 7 */ 630: F_INSERT, /* 8 */ 631: F_INSERT, /* 9 */ 632: F_INSERT, /* : */ 633: F_INSERT, /* ; */ 634: F_INSERT, /* < */ 635: F_INSERT, /* = */ 636: F_INSERT, /* > */ 637: F_INSERT, /* ? */ 638: F_INSERT, /* @ */ 639: F_INSERT, /* A */ 640: F_INSERT, /* B */ 641: F_INSERT, /* C */ 642: F_INSERT, /* D */ 643: F_INSERT, /* E */ 644: F_INSERT, /* F */ 645: F_INSERT, /* G */ 646: F_INSERT, /* H */ 647: F_INSERT, /* I */ 648: F_INSERT, /* J */ 649: F_INSERT, /* K */ 650: F_INSERT, /* L */ 651: F_INSERT, /* M */ 652: F_INSERT, /* N */ 653: F_INSERT, /* O */ 654: F_INSERT, /* P */ 655: F_INSERT, /* Q */ 656: F_INSERT, /* R */ 657: F_INSERT, /* S */ 658: F_INSERT, /* T */ 659: F_INSERT, /* U */ 660: F_INSERT, /* V */ 661: F_INSERT, /* W */ 662: F_INSERT, /* X */ 663: F_INSERT, /* Y */ 664: F_INSERT, /* Z */ 665: F_INSERT, /* [ */ 666: F_INSERT, /* \ */ 667: F_INSERT, /* ] */ 668: F_INSERT, /* ^ */ 669: F_INSERT, /* _ */ 670: F_INSERT, /* ` */ 671: F_INSERT, /* a */ 672: F_INSERT, /* b */ 673: F_INSERT, /* c */ 674: F_INSERT, /* d */ 675: F_INSERT, /* e */ 676: F_INSERT, /* f */ 677: F_INSERT, /* g */ 678: F_INSERT, /* h */ 679: F_INSERT, /* i */ 680: F_INSERT, /* j */ 681: F_INSERT, /* k */ 682: F_INSERT, /* l */ 683: F_INSERT, /* m */ 684: F_INSERT, /* n */ 685: F_INSERT, /* o */ 686: F_INSERT, /* p */ 687: F_INSERT, /* q */ 688: F_INSERT, /* r */ 689: F_INSERT, /* s */ 690: F_INSERT, /* t */ 691: F_INSERT, /* u */ 692: F_INSERT, /* v */ 693: F_INSERT, /* w */ 694: F_INSERT, /* x */ 695: F_INSERT, /* y */ 696: F_INSERT, /* z */ 697: F_INSERT, /* { */ 698: F_INSERT, /* | */ 699: F_INSERT, /* } */ 700: F_INSERT, /* ~ */ 701: F_DELPREV, /* ^? */ 702: F_UNASSIGNED, /* M-^@ */ 703: F_UNASSIGNED, /* M-^A */ 704: F_UNASSIGNED, /* M-^B */ 705: F_UNASSIGNED, /* M-^C */ 706: F_UNASSIGNED, /* M-^D */ 707: F_UNASSIGNED, /* M-^E */ 708: F_UNASSIGNED, /* M-^F */ 709: F_UNASSIGNED, /* M-^G */ 710: F_UNASSIGNED, /* M-^H */ 711: F_UNASSIGNED, /* M-^I */ 712: F_UNASSIGNED, /* M-^J */ 713: F_UNASSIGNED, /* M-^K */ 714: F_UNASSIGNED, /* M-^L */ 715: F_UNASSIGNED, /* M-^M */ 716: F_UNASSIGNED, /* M-^N */ 717: F_UNASSIGNED, /* M-^O */ 718: F_UNASSIGNED, /* M-^P */ 719: F_UNASSIGNED, /* M-^Q */ 720: F_UNASSIGNED, /* M-^R */ 721: F_UNASSIGNED, /* M-^S */ 722: F_UNASSIGNED, /* M-^T */ 723: F_UNASSIGNED, /* M-^U */ 724: F_UNASSIGNED, /* M-^V */ 725: F_UNASSIGNED, /* M-^W */ 726: F_UNASSIGNED, /* M-^X */ 727: F_UNASSIGNED, /* M-^Y */ 728: F_UNASSIGNED, /* M-^Z */ 729: F_UNASSIGNED, /* M-^[ */ 730: F_UNASSIGNED, /* M-^\ */ 731: F_UNASSIGNED, /* M-^] */ 732: F_UNASSIGNED, /* M-^^ */ 733: F_UNASSIGNED, /* M-^_ */ 734: F_UNASSIGNED, /* M-SPACE */ 735: F_UNASSIGNED, /* M-! */ 736: F_UNASSIGNED, /* M-" */ 737: F_UNASSIGNED, /* M-# */ 738: F_UNASSIGNED, /* M-$ */ 739: F_UNASSIGNED, /* M-% */ 740: F_UNASSIGNED, /* M-& */ 741: F_UNASSIGNED, /* M-' */ 742: F_UNASSIGNED, /* M-( */ 743: F_UNASSIGNED, /* M-) */ 744: F_UNASSIGNED, /* M-* */ 745: F_UNASSIGNED, /* M-+ */ 746: F_UNASSIGNED, /* M-, */ 747: F_UNASSIGNED, /* M-- */ 748: F_UNASSIGNED, /* M-. */ 749: F_UNASSIGNED, /* M-/ */ 750: F_UNASSIGNED, /* M-0 */ 751: F_UNASSIGNED, /* M-1 */ 752: F_UNASSIGNED, /* M-2 */ 753: F_UNASSIGNED, /* M-3 */ 754: F_UNASSIGNED, /* M-4 */ 755: F_UNASSIGNED, /* M-5 */ 756: F_UNASSIGNED, /* M-6 */ 757: F_UNASSIGNED, /* M-7 */ 758: F_UNASSIGNED, /* M-8 */ 759: F_UNASSIGNED, /* M-9 */ 760: F_UNASSIGNED, /* M-: */ 761: F_UNASSIGNED, /* M-; */ 762: F_UNASSIGNED, /* M-< */ 763: F_UNASSIGNED, /* M-= */ 764: F_UNASSIGNED, /* M-> */ 765: F_UNASSIGNED, /* M-? */ 766: F_UNASSIGNED, /* M-@ */ 767: F_UNASSIGNED, /* M-A */ 768: F_UNASSIGNED, /* M-B */ 769: F_UNASSIGNED, /* M-C */ 770: F_UNASSIGNED, /* M-D */ 771: F_UNASSIGNED, /* M-E */ 772: F_UNASSIGNED, /* M-F */ 773: F_UNASSIGNED, /* M-G */ 774: F_UNASSIGNED, /* M-H */ 775: F_UNASSIGNED, /* M-I */ 776: F_UNASSIGNED, /* M-J */ 777: F_UNASSIGNED, /* M-K */ 778: F_UNASSIGNED, /* M-L */ 779: F_UNASSIGNED, /* M-M */ 780: F_UNASSIGNED, /* M-N */ 781: F_UNASSIGNED, /* M-O */ 782: F_UNASSIGNED, /* M-P */ 783: F_UNASSIGNED, /* M-Q */ 784: F_UNASSIGNED, /* M-R */ 785: F_UNASSIGNED, /* M-S */ 786: F_UNASSIGNED, /* M-T */ 787: F_UNASSIGNED, /* M-U */ 788: F_UNASSIGNED, /* M-V */ 789: F_UNASSIGNED, /* M-W */ 790: F_UNASSIGNED, /* M-X */ 791: F_UNASSIGNED, /* M-Y */ 792: F_UNASSIGNED, /* M-Z */ 793: F_UNASSIGNED, /* M-[ */ 794: F_UNASSIGNED, /* M-\ */ 795: F_UNASSIGNED, /* M-] */ 796: F_UNASSIGNED, /* M-^ */ 797: F_UNASSIGNED, /* M-_ */ 798: F_UNASSIGNED, /* M-` */ 799: F_UNASSIGNED, /* M-a */ 800: F_UNASSIGNED, /* M-b */ 801: F_UNASSIGNED, /* M-c */ 802: F_UNASSIGNED, /* M-d */ 803: F_UNASSIGNED, /* M-e */ 804: F_UNASSIGNED, /* M-f */ 805: F_UNASSIGNED, /* M-g */ 806: F_UNASSIGNED, /* M-h */ 807: F_UNASSIGNED, /* M-i */ 808: F_UNASSIGNED, /* M-j */ 809: F_UNASSIGNED, /* M-k */ 810: F_UNASSIGNED, /* M-l */ 811: F_UNASSIGNED, /* M-m */ 812: F_UNASSIGNED, /* M-n */ 813: F_UNASSIGNED, /* M-o */ 814: F_UNASSIGNED, /* M-p */ 815: F_UNASSIGNED, /* M-q */ 816: F_UNASSIGNED, /* M-r */ 817: F_UNASSIGNED, /* M-s */ 818: F_UNASSIGNED, /* M-t */ 819: F_UNASSIGNED, /* M-u */ 820: F_UNASSIGNED, /* M-v */ 821: F_UNASSIGNED, /* M-w */ 822: F_UNASSIGNED, /* M-x */ 823: F_UNASSIGNED, /* M-y */ 824: F_UNASSIGNED, /* M-z */ 825: F_UNASSIGNED, /* M-{ */ 826: F_UNASSIGNED, /* M-| */ 827: F_UNASSIGNED, /* M-} */ 828: F_UNASSIGNED, /* M-~ */ 829: F_UNASSIGNED /* M-^? */ 830: }; 831: 832: KEYCMD CcViCmdMap[] = { 833: F_UNASSIGNED, /* ^@ */ 834: F_TOBEG, /* ^A */ 835: F_UNASSIGNED, /* ^B */ 836: F_TTY_INT, /* ^C */ 837: F_LIST_CHOICES, /* ^D */ 838: F_TOEND, /* ^E */ 839: F_UNASSIGNED, /* ^F */ 840: F_LIST_GLOB, /* ^G */ 841: F_DELPREV, /* ^H */ 842: V_CM_COMPLETE, /* ^I */ 843: F_NEWLINE, /* ^J */ 844: F_KILLEND, /* ^K */ 845: F_CLEARDISP, /* ^L */ 846: F_NEWLINE, /* ^M */ 847: F_DOWN_HIST, /* ^N */ 848: F_TTY_FLUSHO, /* ^O */ 849: F_UP_HIST, /* ^P */ 850: F_TTY_STARTO, /* ^Q */ 851: F_REDISP, /* ^R */ 852: F_TTY_STOPO, /* ^S */ 853: F_UNASSIGNED, /* ^T */ 854: F_KILLBEG, /* ^U */ 855: F_UNASSIGNED, /* ^V */ 856: F_DELWORDPREV, /* ^W */ 857: F_EXPAND, /* ^X */ 858: F_UNASSIGNED, /* ^Y */ 859: F_UNASSIGNED, /* ^Z */ 860: F_METANEXT, /* ^[ */ 861: F_TTY_QUIT, /* ^\ */ 862: F_UNASSIGNED, /* ^] */ 863: F_UNASSIGNED, /* ^^ */ 864: F_UNASSIGNED, /* ^_ */ 865: F_CHARFWD, /* SPACE */ 866: F_EXPAND_HISTORY, /* ! */ 867: F_UNASSIGNED, /* " */ 868: F_UNASSIGNED, /* # */ 869: F_TOEND, /* $ */ 870: F_UNASSIGNED, /* % */ 871: F_UNASSIGNED, /* & */ 872: F_UNASSIGNED, /* ' */ 873: F_UNASSIGNED, /* ( */ 874: F_UNASSIGNED, /* ) */ 875: F_EXPAND_GLOB, /* * */ 876: F_UNASSIGNED, /* + */ 877: F_UNASSIGNED, /* , */ 878: F_UNASSIGNED, /* - */ 879: F_UNASSIGNED, /* . */ 880: F_UNASSIGNED, /* / */ 881: V_ZERO, /* 0 */ 882: F_ARGDIGIT, /* 1 */ 883: F_ARGDIGIT, /* 2 */ 884: F_ARGDIGIT, /* 3 */ 885: F_ARGDIGIT, /* 4 */ 886: F_ARGDIGIT, /* 5 */ 887: F_ARGDIGIT, /* 6 */ 888: F_ARGDIGIT, /* 7 */ 889: F_ARGDIGIT, /* 8 */ 890: F_ARGDIGIT, /* 9 */ 891: F_UNASSIGNED, /* : */ 892: F_UNASSIGNED, /* ; */ 893: F_UNASSIGNED, /* < */ 894: F_UNASSIGNED, /* = */ 895: F_UNASSIGNED, /* > */ 896: F_WHICH, /* ? */ 897: F_UNASSIGNED, /* @ */ 898: V_ADDEND, /* A */ 899: F_WORDBACK, /* B */ 900: V_CHGTOEND, /* C */ 901: F_KILLEND, /* D */ 902: F_UNASSIGNED, /* E */ 903: F_UNASSIGNED, /* F */ 904: F_UNASSIGNED, /* G */ 905: F_UNASSIGNED, /* H */ 906: V_INSBEG, /* I */ 907: F_DOWN_SEARCH_HIST, /* J */ 908: F_UP_SEARCH_HIST, /* K */ 909: F_UNASSIGNED, /* L */ 910: F_UNASSIGNED, /* M */ 911: F_UNASSIGNED, /* N */ 912: F_XKEY, /* O */ 913: F_UNASSIGNED, /* P */ 914: F_UNASSIGNED, /* Q */ 915: V_REPLMODE, /* R */ 916: V_SUBSTLINE, /* S */ 917: F_TOGGLE_HIST, /* T */ 918: F_UNASSIGNED, /* U */ 919: F_EXPAND_VARS, /* V */ 920: F_WORDFWD, /* W */ 921: F_DELPREV, /* X */ 922: F_UNASSIGNED, /* Y */ 923: F_UNASSIGNED, /* Z */ 924: F_XKEY, /* [ */ 925: F_UNASSIGNED, /* \ */ 926: F_UNASSIGNED, /* ] */ 927: F_TOBEG, /* ^ */ 928: F_UNASSIGNED, /* _ */ 929: F_UNASSIGNED, /* ` */ 930: V_ADD, /* a */ 931: F_WORDBACK, /* b */ 932: F_UNASSIGNED, /* c */ 933: F_DELWORDNEXT, /* d */ 934: F_UNASSIGNED, /* e */ 935: F_UNASSIGNED, /* f */ 936: F_UNASSIGNED, /* g */ 937: F_CHARBACK, /* h */ 938: V_INSERT, /* i */ 939: F_DOWN_HIST, /* j */ 940: F_UP_HIST, /* k */ 941: F_CHARFWD, /* l */ 942: F_UNASSIGNED, /* m */ 943: F_UNASSIGNED, /* n */ 944: F_UNASSIGNED, /* o */ 945: F_UNASSIGNED, /* p */ 946: F_UNASSIGNED, /* q */ 947: V_REPLONE, /* r */ 948: V_SUBSTCHAR, /* s */ 949: F_TOGGLE_HIST, /* t */ 950: F_UNASSIGNED, /* u */ 951: F_EXPAND_VARS, /* v */ 952: V_WORDBEGNEXT, /* w */ 953: F_DELNEXT, /* x */ 954: F_UNASSIGNED, /* y */ 955: F_UNASSIGNED, /* z */ 956: F_UNASSIGNED, /* { */ 957: F_UNASSIGNED, /* | */ 958: F_UNASSIGNED, /* } */ 959: V_CHGCASE, /* ~ */ 960: F_DELPREV, /* ^? */ 961: F_UNASSIGNED, /* M-^@ */ 962: F_UNASSIGNED, /* M-^A */ 963: F_UNASSIGNED, /* M-^B */ 964: F_UNASSIGNED, /* M-^C */ 965: F_UNASSIGNED, /* M-^D */ 966: F_UNASSIGNED, /* M-^E */ 967: F_UNASSIGNED, /* M-^F */ 968: F_UNASSIGNED, /* M-^G */ 969: F_UNASSIGNED, /* M-^H */ 970: F_UNASSIGNED, /* M-^I */ 971: F_UNASSIGNED, /* M-^J */ 972: F_UNASSIGNED, /* M-^K */ 973: F_UNASSIGNED, /* M-^L */ 974: F_UNASSIGNED, /* M-^M */ 975: F_UNASSIGNED, /* M-^N */ 976: F_UNASSIGNED, /* M-^O */ 977: F_UNASSIGNED, /* M-^P */ 978: F_UNASSIGNED, /* M-^Q */ 979: F_UNASSIGNED, /* M-^R */ 980: F_UNASSIGNED, /* M-^S */ 981: F_UNASSIGNED, /* M-^T */ 982: F_UNASSIGNED, /* M-^U */ 983: F_UNASSIGNED, /* M-^V */ 984: F_UNASSIGNED, /* M-^W */ 985: F_UNASSIGNED, /* M-^X */ 986: F_UNASSIGNED, /* M-^Y */ 987: F_UNASSIGNED, /* M-^Z */ 988: F_UNASSIGNED, /* M-^[ */ 989: F_UNASSIGNED, /* M-^\ */ 990: F_UNASSIGNED, /* M-^] */ 991: F_UNASSIGNED, /* M-^^ */ 992: F_UNASSIGNED, /* M-^_ */ 993: F_UNASSIGNED, /* M-SPACE */ 994: F_UNASSIGNED, /* M-! */ 995: F_UNASSIGNED, /* M-" */ 996: F_UNASSIGNED, /* M-# */ 997: F_UNASSIGNED, /* M-$ */ 998: F_UNASSIGNED, /* M-% */ 999: F_UNASSIGNED, /* M-& */ 1000: F_UNASSIGNED, /* M-' */ 1001: F_UNASSIGNED, /* M-( */ 1002: F_UNASSIGNED, /* M-) */ 1003: F_UNASSIGNED, /* M-* */ 1004: F_UNASSIGNED, /* M-+ */ 1005: F_UNASSIGNED, /* M-, */ 1006: F_UNASSIGNED, /* M-- */ 1007: F_UNASSIGNED, /* M-. */ 1008: F_UNASSIGNED, /* M-/ */ 1009: F_UNASSIGNED, /* M-0 */ 1010: F_UNASSIGNED, /* M-1 */ 1011: F_UNASSIGNED, /* M-2 */ 1012: F_UNASSIGNED, /* M-3 */ 1013: F_UNASSIGNED, /* M-4 */ 1014: F_UNASSIGNED, /* M-5 */ 1015: F_UNASSIGNED, /* M-6 */ 1016: F_UNASSIGNED, /* M-7 */ 1017: F_UNASSIGNED, /* M-8 */ 1018: F_UNASSIGNED, /* M-9 */ 1019: F_UNASSIGNED, /* M-: */ 1020: F_UNASSIGNED, /* M-; */ 1021: F_UNASSIGNED, /* M-< */ 1022: F_UNASSIGNED, /* M-= */ 1023: F_UNASSIGNED, /* M-> */ 1024: F_HELPME, /* M-? */ 1025: F_UNASSIGNED, /* M-@ */ 1026: F_UNASSIGNED, /* M-A */ 1027: F_UNASSIGNED, /* M-B */ 1028: F_UNASSIGNED, /* M-C */ 1029: F_UNASSIGNED, /* M-D */ 1030: F_UNASSIGNED, /* M-E */ 1031: F_UNASSIGNED, /* M-F */ 1032: F_UNASSIGNED, /* M-G */ 1033: F_UNASSIGNED, /* M-H */ 1034: F_UNASSIGNED, /* M-I */ 1035: F_UNASSIGNED, /* M-J */ 1036: F_UNASSIGNED, /* M-K */ 1037: F_UNASSIGNED, /* M-L */ 1038: F_UNASSIGNED, /* M-M */ 1039: F_UNASSIGNED, /* M-N */ 1040: F_XKEY, /* M-O *//* extended key esc PWP Mar 88 */ 1041: F_UNASSIGNED, /* M-P */ 1042: F_UNASSIGNED, /* M-Q */ 1043: F_UNASSIGNED, /* M-R */ 1044: F_UNASSIGNED, /* M-S */ 1045: F_UNASSIGNED, /* M-T */ 1046: F_UNASSIGNED, /* M-U */ 1047: F_UNASSIGNED, /* M-V */ 1048: F_UNASSIGNED, /* M-W */ 1049: F_UNASSIGNED, /* M-X */ 1050: F_UNASSIGNED, /* M-Y */ 1051: F_UNASSIGNED, /* M-Z */ 1052: F_XKEY, /* M-[ *//* extended key esc -mf Oct 87 */ 1053: F_UNASSIGNED, /* M-\ */ 1054: F_UNASSIGNED, /* M-] */ 1055: F_UNASSIGNED, /* M-^ */ 1056: F_UNASSIGNED, /* M-_ */ 1057: F_UNASSIGNED, /* M-` */ 1058: F_UNASSIGNED, /* M-a */ 1059: F_UNASSIGNED, /* M-b */ 1060: F_UNASSIGNED, /* M-c */ 1061: F_UNASSIGNED, /* M-d */ 1062: F_UNASSIGNED, /* M-e */ 1063: F_UNASSIGNED, /* M-f */ 1064: F_UNASSIGNED, /* M-g */ 1065: F_UNASSIGNED, /* M-h */ 1066: F_UNASSIGNED, /* M-i */ 1067: F_UNASSIGNED, /* M-j */ 1068: F_UNASSIGNED, /* M-k */ 1069: F_UNASSIGNED, /* M-l */ 1070: F_UNASSIGNED, /* M-m */ 1071: F_UNASSIGNED, /* M-n */ 1072: F_UNASSIGNED, /* M-o */ 1073: F_UNASSIGNED, /* M-p */ 1074: F_UNASSIGNED, /* M-q */ 1075: F_UNASSIGNED, /* M-r */ 1076: F_UNASSIGNED, /* M-s */ 1077: F_UNASSIGNED, /* M-t */ 1078: F_UNASSIGNED, /* M-u */ 1079: F_UNASSIGNED, /* M-v */ 1080: F_UNASSIGNED, /* M-w */ 1081: F_UNASSIGNED, /* M-x */ 1082: F_UNASSIGNED, /* M-y */ 1083: F_UNASSIGNED, /* M-z */ 1084: F_UNASSIGNED, /* M-{ */ 1085: F_UNASSIGNED, /* M-| */ 1086: F_UNASSIGNED, /* M-} */ 1087: F_UNASSIGNED, /* M-~ */ 1088: F_UNASSIGNED /* M-^? */ 1089: }; 1090: 1091: 1092: struct KeyFuncs FuncNames[] = { 1093: "backward-char", F_CHARBACK, 1094: #ifdef LONGFUNCS 1095: "Move back a character", 1096: #endif 1097: "backward-delete-char", F_DELPREV, 1098: #ifdef LONGFUNCS 1099: "Delete the character behind cursor", 1100: #endif 1101: "backward-delete-word", F_DELWORDPREV, 1102: #ifdef LONGFUNCS 1103: "Cut from beginning of current word to cursor - saved in cut buffer", 1104: #endif 1105: "backward-kill-line", F_KILLBEG, 1106: #ifdef LONGFUNCS 1107: "Cut from beginning of line to cursor - save in cut buffer", 1108: #endif 1109: "backward-word", F_WORDBACK, 1110: #ifdef LONGFUNCS 1111: "Move to beginning of current word", 1112: #endif 1113: "beginning-of-line", F_TOBEG, 1114: #ifdef LONGFUNCS 1115: "Move to beginning of line", 1116: #endif 1117: "capitalize-word", F_CASECAPITAL, 1118: #ifdef LONGFUNCS 1119: "Capitalize the characters from cursor to end of current word", 1120: #endif 1121: "change-case", V_CHGCASE, 1122: #ifdef LONGFUNCS 1123: "Vi change case of character under cursor and advance one character", 1124: #endif 1125: "change-till-end-of-line", V_CHGTOEND, /* backwards compat. */ 1126: #ifdef LONGFUNCS 1127: "Vi change to end of line", 1128: #endif 1129: "clear-screen", F_CLEARDISP, 1130: #ifdef LONGFUNCS 1131: "Clear screen leaving current line on top", 1132: #endif 1133: "complete-word", F_COMPLETE, 1134: #ifdef LONGFUNCS 1135: "Complete current word", 1136: #endif 1137: "copy-prev-word", F_COPYPREV, 1138: #ifdef LONGFUNCS 1139: "Copy current word to cursor", 1140: #endif 1141: "copy-region-as-kill", F_COPYREGION, 1142: #ifdef LONGFUNCS 1143: "Copy area between mark and cursor to cut buffer", 1144: #endif 1145: "delete-char", F_DELNEXT, 1146: #ifdef LONGFUNCS 1147: "Delete character under cursor", 1148: #endif 1149: "delete-char-or-list", F_LIST_DELNEXT, 1150: #ifdef LONGFUNCS 1151: "Delete character under cursor or list completions if at end of line", 1152: #endif 1153: "delete-word", F_DELWORDNEXT, 1154: #ifdef LONGFUNCS 1155: "Cut from cursor to end of current word - save in cut buffer", 1156: #endif 1157: "digit", F_DIGIT, 1158: #ifdef LONGFUNCS 1159: "Adds to argument if started or enters digit", 1160: #endif 1161: "digit-argument", F_ARGDIGIT, 1162: #ifdef LONGFUNCS 1163: "Digit that starts argument", 1164: #endif 1165: "down-history", F_DOWN_HIST, 1166: #ifdef LONGFUNCS 1167: "Move to next history line", 1168: #endif 1169: "downcase-word", F_CASELOWER, 1170: #ifdef LONGFUNCS 1171: "Lowercase the characters from cursor to end of current word", 1172: #endif 1173: "end-of-file", F_SEND_EOF, 1174: #ifdef LONGFUNCS 1175: "Indicate end of file", 1176: #endif 1177: "end-of-line", F_TOEND, 1178: #ifdef LONGFUNCS 1179: "Move cursor to end of line", 1180: #endif 1181: "exchange-point-and-mark", F_EXCHANGE_MARK, 1182: #ifdef LONGFUNCS 1183: "Exchange the cursor and mark", 1184: #endif 1185: "expand-glob", F_EXPAND_GLOB, 1186: #ifdef LONGFUNCS 1187: "Expand file name wildcards", 1188: #endif 1189: "expand-history", F_EXPAND_HISTORY, 1190: #ifdef LONGFUNCS 1191: "Expand history escapes", 1192: #endif 1193: "expand-line", F_EXPAND, 1194: #ifdef LONGFUNCS 1195: "Expand the history escapes in a line", 1196: #endif 1197: "expand-variables", F_EXPAND_VARS, 1198: #ifdef LONGFUNCS 1199: "Expand variables", 1200: #endif 1201: "forward-char", F_CHARFWD, 1202: #ifdef LONGFUNCS 1203: "Move forward one character", 1204: #endif 1205: "forward-word", F_WORDFWD, 1206: #ifdef LONGFUNCS 1207: "Move forward to end of current word", 1208: #endif 1209: "gosmacs-transpose-chars", F_GCHARSWITCH, 1210: #ifdef LONGFUNCS 1211: "Exchange the two characters before the cursor", 1212: #endif 1213: "history-search-backward", F_UP_SEARCH_HIST, 1214: #ifdef LONGFUNCS 1215: "Search in history backwards for line beginning as current", 1216: #endif 1217: "history-search-forward", F_DOWN_SEARCH_HIST, 1218: #ifdef LONGFUNCS 1219: "Search in history forward for line beginning as current", 1220: #endif 1221: "insert-last-word", F_LAST_ITEM, 1222: #ifdef LONGFUNCS 1223: "Insert last item of previous command", 1224: #endif 1225: "keyboard-quit", F_STARTOVER, 1226: #ifdef LONGFUNCS 1227: "Clear line", 1228: #endif 1229: "kill-line", F_KILLEND, 1230: #ifdef LONGFUNCS 1231: "Cut to end of line and save in cut buffer", 1232: #endif 1233: "kill-region", F_KILLREGION, 1234: #ifdef LONGFUNCS 1235: "Cut area between mark and cursor and save in cut buffer", 1236: #endif 1237: "kill-whole-line", F_KILLALL, 1238: #ifdef LONGFUNCS 1239: "Cut the entire line and save in cut buffer", 1240: #endif 1241: "list-choices", F_LIST_CHOICES, 1242: #ifdef LONGFUNCS 1243: "List choices for completion", 1244: #endif 1245: "list-glob", F_LIST_GLOB, 1246: #ifdef LONGFUNCS 1247: "List file name wildcard matches", 1248: #endif 1249: "list-or-eof", F_LIST_EOF, 1250: #ifdef LONGFUNCS 1251: "List choices for completion or indicate end of file if empty line", 1252: #endif 1253: "magic-space", F_MAGIC_SPACE, 1254: #ifdef LONGFUNCS 1255: "Expand history escapes and insert a space", 1256: #endif 1257: "newline", F_NEWLINE, 1258: #ifdef LONGFUNCS 1259: "Execute command", 1260: #endif 1261: "overwrite-mode", F_INSOVR, 1262: #ifdef LONGFUNCS 1263: "Switch from insert to overwrite mode or vice versa", 1264: #endif 1265: "prefix-meta", F_METANEXT, 1266: #ifdef LONGFUNCS 1267: "Add 8th bit to next character typed", 1268: #endif 1269: "quoted-insert", F_QUOTE, 1270: #ifdef LONGFUNCS 1271: "Add the next character typed to the line verbatim", 1272: #endif 1273: "redisplay", F_REDISP, 1274: #ifdef LONGFUNCS 1275: "Redisplay everything", 1276: #endif 1277: "run-fg-editor", F_RUN_FG_EDITOR, 1278: #ifdef LONGFUNCS 1279: "Restart stopped editor", 1280: #endif 1281: "run-help", F_HELPME, 1282: #ifdef LONGFUNCS 1283: "Look for help on current command", 1284: #endif 1285: "self-insert-command", F_INSERT, 1286: #ifdef LONGFUNCS 1287: "This character is added to the line", 1288: #endif 1289: "sequence-lead-in", F_XKEY, 1290: #ifdef LONGFUNCS 1291: "This character is the first in a character sequence", 1292: #endif 1293: "set-mark-command", F_SET_MARK, 1294: #ifdef LONGFUNCS 1295: "Set the mark at cursor", 1296: #endif 1297: "spell-word", F_CORRECT, 1298: #ifdef LONGFUNCS 1299: "Correct the spelling of current word", 1300: #endif 1301: "spell-line", F_CORRECT_L, 1302: #ifdef LONGFUNCS 1303: "Correct the spelling of entire line", 1304: #endif 1305: "toggle-literal-history", F_TOGGLE_HIST, 1306: #ifdef LONGFUNCS 1307: "Toggle between literal and lexical current history line", 1308: #endif 1309: "transpose-chars", F_CHARSWITCH, 1310: #ifdef LONGFUNCS 1311: "Exchange the character to the left of the cursor with the one under", 1312: #endif 1313: "transpose-gosling", F_GCHARSWITCH, 1314: #ifdef LONGFUNCS 1315: "Exchange the two characters before the cursor", 1316: /* EGS: make Convex Users happy */ 1317: #endif 1318: "tty-dsusp", F_TTY_DSUSP, 1319: #ifdef LONGFUNCS 1320: "Tty delayed suspend character", 1321: #endif 1322: "tty-flush-output", F_TTY_FLUSHO, 1323: #ifdef LONGFUNCS 1324: "Tty flush output character", 1325: #endif 1326: "tty-sigintr", F_TTY_INT, 1327: #ifdef LONGFUNCS 1328: "Tty interrupt character", 1329: #endif 1330: "tty-sigquit", F_TTY_QUIT, 1331: #ifdef LONGFUNCS 1332: "Tty quit character", 1333: #endif 1334: "tty-sigtsusp", F_TTY_TSUSP, 1335: #ifdef LONGFUNCS 1336: "Tty suspend character", 1337: #endif 1338: "tty-start-output", F_TTY_STARTO, 1339: #ifdef LONGFUNCS 1340: "Tty allow output character", 1341: #endif 1342: "tty-stop-output", F_TTY_STOPO, 1343: #ifdef LONGFUNCS 1344: "Tty disallow output character", 1345: #endif 1346: "undefined-key", F_UNASSIGNED, 1347: #ifdef LONGFUNCS 1348: "Indicates unbound character", 1349: #endif 1350: "universal-argument", F_ARGFOUR, 1351: #ifdef LONGFUNCS 1352: "Emacs universal argument (argument times 4)", 1353: #endif 1354: "up-history", F_UP_HIST, 1355: #ifdef LONGFUNCS 1356: "Move to previous history line", 1357: #endif 1358: "upcase-word", F_CASEUPPER, 1359: #ifdef LONGFUNCS 1360: "Uppercase the characters from cursor to end of current word", 1361: #endif 1362: "vi-beginning-of-next-word", V_WORDBEGNEXT, 1363: #ifdef LONGFUNCS 1364: "Vi goto the beginning of next word", 1365: #endif 1366: "vi-add", V_ADD, 1367: #ifdef LONGFUNCS 1368: "Vi enter insert mode after the cursor", 1369: #endif 1370: "vi-add-at-eol", V_ADDEND, 1371: #ifdef LONGFUNCS 1372: "Vi enter insert mode at end of line", 1373: #endif 1374: "vi-chg-case", V_CHGCASE, 1375: #ifdef LONGFUNCS 1376: "Vi change case of character under cursor and advance one character", 1377: #endif 1378: "vi-chg-to-eol", V_CHGTOEND, 1379: #ifdef LONGFUNCS 1380: "Vi change to end of line", 1381: #endif 1382: "vi-cmd-mode", V_CMD_MODE, 1383: #ifdef LONGFUNCS 1384: "Enter vi command mode (use alternative key bindings)", 1385: #endif 1386: "vi-cmd-mode-complete", V_CM_COMPLETE, 1387: #ifdef LONGFUNCS 1388: "Vi command mode complete current word", 1389: #endif 1390: "vi-insert", V_INSERT, 1391: #ifdef LONGFUNCS 1392: "Enter vi insert mode", 1393: #endif 1394: "vi-insert-at-bol", V_INSBEG, 1395: #ifdef LONGFUNCS 1396: "Enter vi insert mode at beginning of line", 1397: #endif 1398: "vi-replace-char", V_REPLONE, 1399: #ifdef LONGFUNCS 1400: "Vi replace character under the cursor with the next character typed", 1401: #endif 1402: "vi-replace-mode", V_REPLMODE, 1403: #ifdef LONGFUNCS 1404: "Vi replace mode", 1405: #endif 1406: "vi-substitute-char", V_SUBSTCHAR, 1407: #ifdef LONGFUNCS 1408: "Vi replace character under the cursor and enter insert mode", 1409: #endif 1410: "vi-substitute-line", V_SUBSTLINE, 1411: #ifdef LONGFUNCS 1412: "Vi replace entire line", 1413: #endif 1414: "vi-zero", V_ZERO, 1415: #ifdef LONGFUNCS 1416: "Vi goto the beginning of line", 1417: #endif 1418: "which-command", F_WHICH, 1419: #ifdef LONGFUNCS 1420: "Perform which of current command", 1421: #endif 1422: "yank", F_YANK_KILL, 1423: #ifdef LONGFUNCS 1424: "Paste cut buffer at cursor position", 1425: #endif 1426: 0, 0 1427: }; 1428: 1429: #ifdef DEBUG_EDIT 1430: void 1431: CheckMaps() 1432: { /* check the size of the key maps */ 1433: int c1 = (256 * sizeof(KEYCMD)); 1434: 1435: if ((sizeof(CcKeyMap)) != c1) 1436: xprintf("CcKeyMap should be 256 entries, but is %d.\r\n", 1437: (sizeof(CcKeyMap) / sizeof(KEYCMD))); 1438: 1439: if ((sizeof(CcAltMap)) != c1) 1440: xprintf("CcAltMap should be 256 entries, but is %d.\r\n", 1441: (sizeof(CcAltMap) / sizeof(KEYCMD))); 1442: 1443: if ((sizeof(CcEmacsMap)) != c1) 1444: xprintf("CcEmacsMap should be 256 entries, but is %d.\r\n", 1445: (sizeof(CcEmacsMap) / sizeof(KEYCMD))); 1446: 1447: if ((sizeof(CcViMap)) != c1) 1448: xprintf("CcViMap should be 256 entries, but is %d.\r\n", 1449: (sizeof(CcViMap) / sizeof(KEYCMD))); 1450: 1451: if ((sizeof(CcViCmdMap)) != c1) 1452: xprintf("CcViCmdMap should be 256 entries, but is %d.\r\n", 1453: (sizeof(CcViCmdMap) / sizeof(KEYCMD))); 1454: } 1455: 1456: #endif 1457: 1458: bool MapsAreInited = 0; 1459: bool NLSMapsAreInited = 0; 1460: bool NoNLSRebind; 1461: 1462: void 1463: ed_INLSMaps() 1464: { 1465: register int i; 1466: 1467: if (AsciiOnly) 1468: return; 1469: if (NoNLSRebind) 1470: return; 1471: for (i = 0200; i <= 0377; i++) { 1472: if (Isprint(i)) { 1473: CcKeyMap[i] = F_INSERT; 1474: } 1475: } 1476: NLSMapsAreInited = 1; 1477: } 1478: 1479: static void 1480: ed_IMetaBindings() 1481: { 1482: Char buf[3]; 1483: register int i; 1484: register KEYCMD *map; 1485: 1486: map = CcKeyMap; 1487: for (i = 0; i <= 0377 && CcKeyMap[i] != F_METANEXT; i++); 1488: if (i > 0377) { 1489: for (i = 0; i <= 0377 && CcAltMap[i] != F_METANEXT; i++); 1490: if (i > 0377) { 1491: i = 033; 1492: if (VImode) 1493: map = CcAltMap; 1494: } 1495: else { 1496: map = CcAltMap; 1497: } 1498: } 1499: buf[0] = i; 1500: buf[2] = 0; 1501: for (i = 0200; i <= 0377; i++) { 1502: if (map[i] != F_INSERT && map[i] != F_UNASSIGNED && map[i] != F_XKEY) { 1503: buf[1] = i & ASCII; 1504: AddXKeyCmd(buf, (Char) map[i]); 1505: } 1506: } 1507: map[buf[0]] = F_XKEY; 1508: } 1509: 1510: void 1511: ed_IVIMaps() 1512: { 1513: register int i; 1514: 1515: VImode = 1; 1516: (void) ResetXmap(VImode); 1517: for (i = 0; i < 256; i++) { 1518: CcKeyMap[i] = CcViMap[i]; 1519: CcAltMap[i] = CcViCmdMap[i]; 1520: } 1521: ed_IMetaBindings(); 1522: (void) ed_INLSMaps(); 1523: BindArrowKeys(); 1524: } 1525: 1526: void 1527: ed_IEmacsMaps() 1528: { 1529: register int i; 1530: Char buf[3]; 1531: 1532: VImode = 0; 1533: (void) ResetXmap(VImode); 1534: for (i = 0; i < 256; i++) { 1535: CcKeyMap[i] = CcEmacsMap[i]; 1536: CcAltMap[i] = F_UNASSIGNED; 1537: } 1538: ed_IMetaBindings(); 1539: (void) ed_INLSMaps(); 1540: buf[0] = 030; 1541: buf[2] = 0; 1542: buf[1] = 030; 1543: AddXKeyCmd(buf, F_EXCHANGE_MARK); 1544: buf[1] = '*'; 1545: AddXKeyCmd(buf, F_EXPAND_GLOB); 1546: buf[1] = '$'; 1547: AddXKeyCmd(buf, F_EXPAND_VARS); 1548: buf[1] = 'G'; 1549: AddXKeyCmd(buf, F_LIST_GLOB); 1550: buf[1] = 'g'; 1551: AddXKeyCmd(buf, F_LIST_GLOB); 1552: BindArrowKeys(); 1553: } 1554: 1555: void 1556: ed_IMaps() 1557: { 1558: if (MapsAreInited) 1559: return; 1560: #ifdef VIDEFAULT 1561: ed_IVIMaps(); 1562: #else 1563: ed_IEmacsMaps(); 1564: #endif 1565: 1566: MapsAreInited = 1; 1567: }