mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-20 16:22:38 -05:00
438 lines
7.7 KiB
C
438 lines
7.7 KiB
C
/* ebind.c -- implements ebind.h */
|
|
#include "ebind.h"
|
|
|
|
/* ebind.c
|
|
*
|
|
* Initial default key to function bindings
|
|
*
|
|
* Modified by Petri Kutvonen
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
#include "basic.h"
|
|
#include "bind.h"
|
|
#include "estruct.h"
|
|
#include "bindable.h"
|
|
#include "buffer.h"
|
|
#include "eval.h"
|
|
#include "exec.h"
|
|
#include "file.h"
|
|
#include "isearch.h"
|
|
#include "line.h"
|
|
#include "random.h"
|
|
#include "region.h"
|
|
#include "search.h"
|
|
#include "spawn.h"
|
|
#include "window.h"
|
|
#include "word.h"
|
|
|
|
/*
|
|
* Command table.
|
|
* This table is *roughly* in ASCII order, left to right across the
|
|
* characters of the command. This explains the funny location of the
|
|
* control-X commands.
|
|
*/
|
|
struct key_tab keytab[NBINDS] = {
|
|
{CONTROL | 'A', (fn_t) gotobol}
|
|
,
|
|
{CONTROL | 'B', (fn_t) backchar}
|
|
,
|
|
{CONTROL | 'C', insspace}
|
|
,
|
|
{CONTROL | 'D', forwdel}
|
|
,
|
|
{CONTROL | 'E', (fn_t) gotoeol}
|
|
,
|
|
{CONTROL | 'F', (fn_t) forwchar}
|
|
,
|
|
{CONTROL | 'G', ctrlg}
|
|
,
|
|
{CONTROL | 'H', backdel}
|
|
,
|
|
{CONTROL | 'I', insert_tab}
|
|
,
|
|
{CONTROL | 'J', indent}
|
|
,
|
|
{CONTROL | 'K', killtext}
|
|
,
|
|
{CONTROL | 'L', redraw}
|
|
,
|
|
{CONTROL | 'M', insert_newline}
|
|
,
|
|
{CONTROL | 'N', (fn_t) forwline}
|
|
,
|
|
{CONTROL | 'O', openline}
|
|
,
|
|
{CONTROL | 'P', (fn_t) backline}
|
|
,
|
|
{CONTROL | 'Q', quote}
|
|
,
|
|
{CONTROL | 'R', backsearch}
|
|
,
|
|
{CONTROL | 'S', forwsearch}
|
|
,
|
|
{CONTROL | 'T', (fn_t) twiddle}
|
|
,
|
|
{CONTROL | 'U', unarg}
|
|
,
|
|
{CONTROL | 'V', (fn_t) forwpage}
|
|
,
|
|
{CONTROL | 'W', killregion}
|
|
,
|
|
{CONTROL | 'X', cex}
|
|
,
|
|
{CONTROL | 'Y', yank}
|
|
,
|
|
{CONTROL | 'Z', (fn_t) backpage}
|
|
,
|
|
{CONTROL | ']', metafn}
|
|
,
|
|
{CTLX | CONTROL | 'B', listbuffers}
|
|
,
|
|
{CTLX | CONTROL | 'C', quit}
|
|
, /* Hard quit. */
|
|
#if PKCODE & AEDIT
|
|
{CTLX | CONTROL | 'A', detab}
|
|
,
|
|
#endif
|
|
#if PKCODE
|
|
{CTLX | CONTROL | 'D', filesave}
|
|
, /* alternative */
|
|
#else
|
|
#if AEDIT
|
|
{CTLX | CONTROL | 'D', detab}
|
|
,
|
|
#endif
|
|
#endif
|
|
#if AEDIT
|
|
{CTLX | CONTROL | 'E', entab}
|
|
,
|
|
#endif
|
|
{CTLX | CONTROL | 'F', filefind}
|
|
,
|
|
{CTLX | CONTROL | 'I', insfile}
|
|
,
|
|
{CTLX | CONTROL | 'L', lowerregion}
|
|
,
|
|
{CTLX | CONTROL | 'M', delmode}
|
|
,
|
|
{CTLX | CONTROL | 'N', mvdnwind}
|
|
,
|
|
{CTLX | CONTROL | 'O', deblank}
|
|
,
|
|
{CTLX | CONTROL | 'P', mvupwind}
|
|
,
|
|
{CTLX | CONTROL | 'R', fileread}
|
|
,
|
|
{CTLX | CONTROL | 'S', filesave}
|
|
,
|
|
#if AEDIT
|
|
{CTLX | CONTROL | 'T', trim}
|
|
,
|
|
#endif
|
|
{CTLX | CONTROL | 'U', upperregion}
|
|
,
|
|
{CTLX | CONTROL | 'V', viewfile}
|
|
,
|
|
{CTLX | CONTROL | 'W', filewrite}
|
|
,
|
|
{CTLX | CONTROL | 'X', (fn_t) swapmark}
|
|
,
|
|
{CTLX | CONTROL | 'Z', shrinkwind}
|
|
,
|
|
{CTLX | '?', deskey}
|
|
,
|
|
{CTLX | '!', spawn}
|
|
,
|
|
{CTLX | '@', pipecmd}
|
|
,
|
|
{CTLX | '#', filter_buffer}
|
|
,
|
|
{CTLX | '$', execprg}
|
|
,
|
|
{CTLX | '=', showcpos}
|
|
,
|
|
{CTLX | '(', ctlxlp}
|
|
,
|
|
{CTLX | ')', ctlxrp}
|
|
,
|
|
{CTLX | '^', enlargewind}
|
|
,
|
|
{CTLX | '0', delwind}
|
|
,
|
|
{CTLX | '1', onlywind}
|
|
,
|
|
{CTLX | '2', splitwind}
|
|
,
|
|
{CTLX | 'A', setvar}
|
|
,
|
|
{CTLX | 'B', usebuffer}
|
|
,
|
|
{CTLX | 'C', spawncli}
|
|
,
|
|
#if BSD | __hpux | SVR4
|
|
{CTLX | 'D', bktoshell}
|
|
,
|
|
#endif
|
|
{CTLX | 'E', ctlxe}
|
|
,
|
|
{CTLX | 'F', setfillcol}
|
|
,
|
|
{CTLX | 'K', killbuffer}
|
|
,
|
|
{CTLX | 'M', setemode}
|
|
,
|
|
{CTLX | 'N', filename}
|
|
,
|
|
{CTLX | 'O', nextwind}
|
|
,
|
|
{CTLX | 'P', prevwind}
|
|
,
|
|
#if PKCODE
|
|
{CTLX | 'Q', quote}
|
|
, /* alternative */
|
|
#endif
|
|
#if ISRCH
|
|
{CTLX | 'R', risearch}
|
|
,
|
|
{CTLX | 'S', fisearch}
|
|
,
|
|
#endif
|
|
{CTLX | 'W', resize}
|
|
,
|
|
{CTLX | 'X', nextbuffer}
|
|
,
|
|
{CTLX | 'Z', enlargewind}
|
|
,
|
|
#if WORDPRO
|
|
{META | CONTROL | 'C', wordcount}
|
|
,
|
|
#endif
|
|
#if PKCODE
|
|
{META | CONTROL | 'D', newsize}
|
|
,
|
|
#endif
|
|
#if PROC
|
|
{META | CONTROL | 'E', execproc}
|
|
,
|
|
#endif
|
|
#if CFENCE
|
|
{META | CONTROL | 'F', getfence}
|
|
,
|
|
#endif
|
|
{META | CONTROL | 'H', delbword}
|
|
,
|
|
{META | CONTROL | 'K', unbindkey}
|
|
,
|
|
{META | CONTROL | 'L', reposition}
|
|
,
|
|
{META | CONTROL | 'M', delgmode}
|
|
,
|
|
{META | CONTROL | 'N', namebuffer}
|
|
,
|
|
{META | CONTROL | 'R', qreplace}
|
|
,
|
|
{META | CONTROL | 'S', newsize}
|
|
,
|
|
{META | CONTROL | 'T', newwidth}
|
|
,
|
|
{META | CONTROL | 'V', scrnextdw}
|
|
,
|
|
#if WORDPRO
|
|
{META | CONTROL | 'W', killpara}
|
|
,
|
|
#endif
|
|
{META | CONTROL | 'Z', scrnextup}
|
|
,
|
|
{META | ' ', (fn_t) setmark}
|
|
,
|
|
{META | '?', help}
|
|
,
|
|
{META | '!', reposition}
|
|
,
|
|
{META | '.', (fn_t) setmark}
|
|
,
|
|
{META | '>', (fn_t) gotoeob}
|
|
,
|
|
{META | '<', (fn_t) gotobob}
|
|
,
|
|
{META | '~', unmark}
|
|
,
|
|
#if APROP
|
|
{META | 'A', apro}
|
|
,
|
|
#endif
|
|
{META | 'B', backword}
|
|
,
|
|
{META | 'C', capword}
|
|
,
|
|
{META | 'D', delfword}
|
|
,
|
|
{META | 'F', forwword}
|
|
,
|
|
{META | 'G', gotoline}
|
|
,
|
|
#if PKCODE
|
|
#if WORDPRO
|
|
{META | 'J', justpara}
|
|
,
|
|
#endif
|
|
#endif
|
|
{META | 'K', bindtokey}
|
|
,
|
|
{META | 'L', lowerword}
|
|
,
|
|
{META | 'M', setgmode}
|
|
,
|
|
#if WORDPRO
|
|
{META | 'N', gotoeop}
|
|
,
|
|
{META | 'P', gotobop}
|
|
,
|
|
{META | 'Q', fillpara}
|
|
,
|
|
#endif
|
|
{META | 'R', sreplace}
|
|
,
|
|
#if PKCODE
|
|
{META | 'S', forwhunt}
|
|
,
|
|
#else
|
|
#if BSD
|
|
{META | 'S', bktoshell}
|
|
,
|
|
#endif
|
|
#endif
|
|
{META | 'U', upperword}
|
|
,
|
|
{META | 'V', (fn_t) backpage}
|
|
,
|
|
{META | 'W', copyregion}
|
|
,
|
|
{META | 'X', namedcmd}
|
|
,
|
|
{META | 'Z', quickexit}
|
|
,
|
|
{META | 0x7F, delbword}
|
|
,
|
|
|
|
#if MSDOS
|
|
{SPEC | CONTROL | '_', forwhunt}
|
|
,
|
|
{SPEC | CONTROL | 'S', backhunt}
|
|
,
|
|
{SPEC | 71, (fn_t) gotobol}
|
|
,
|
|
{SPEC | 72, (fn_t) backline}
|
|
,
|
|
{SPEC | 73, (fn_t) backpage}
|
|
,
|
|
{SPEC | 75, (fn_t) backchar}
|
|
,
|
|
{SPEC | 77, (fn_t) forwchar}
|
|
,
|
|
{SPEC | 79, (fn_t) gotoeol}
|
|
,
|
|
{SPEC | 80, (fn_t) forwline}
|
|
,
|
|
{SPEC | 81, (fn_t) forwpage}
|
|
,
|
|
{SPEC | 82, insspace}
|
|
,
|
|
{SPEC | 83, forwdel}
|
|
,
|
|
{SPEC | 115, backword}
|
|
,
|
|
{SPEC | 116, forwword}
|
|
,
|
|
#if WORDPRO
|
|
{SPEC | 132, gotobop}
|
|
,
|
|
{SPEC | 118, gotoeop}
|
|
,
|
|
#endif
|
|
{SPEC | 84, cbuf1}
|
|
,
|
|
{SPEC | 85, cbuf2}
|
|
,
|
|
{SPEC | 86, cbuf3}
|
|
,
|
|
{SPEC | 87, cbuf4}
|
|
,
|
|
{SPEC | 88, cbuf5}
|
|
,
|
|
{SPEC | 89, cbuf6}
|
|
,
|
|
{SPEC | 90, cbuf7}
|
|
,
|
|
{SPEC | 91, cbuf8}
|
|
,
|
|
{SPEC | 92, cbuf9}
|
|
,
|
|
{SPEC | 93, cbuf10}
|
|
,
|
|
#if PKCODE
|
|
{SPEC | 117, (fn_t) gotoeob}
|
|
,
|
|
{SPEC | 119, (fn_t) gotobob}
|
|
,
|
|
{SPEC | 141, gotobop}
|
|
,
|
|
{SPEC | 145, gotoeop}
|
|
,
|
|
{SPEC | 146, yank}
|
|
,
|
|
{SPEC | 147, killregion}
|
|
,
|
|
#endif
|
|
#endif
|
|
|
|
#if VT220
|
|
{SPEC | '1', (fn_t) gotobob /* fisearch */}
|
|
, /* VT220 keys */
|
|
{SPEC | '2', yank}
|
|
,
|
|
{SPEC | '3', forwdel /* killregion */}
|
|
,
|
|
{SPEC | '4', (fn_t) gotoeob /* setmark */}
|
|
,
|
|
{SPEC | '5', (fn_t) backpage}
|
|
,
|
|
{SPEC | '6', (fn_t) forwpage}
|
|
,
|
|
{SPEC | 'A', (fn_t) backline}
|
|
,
|
|
{SPEC | 'B', (fn_t) forwline}
|
|
,
|
|
{SPEC | 'C', (fn_t) forwchar}
|
|
,
|
|
{SPEC | 'D', (fn_t) backchar}
|
|
,
|
|
{SPEC | 'c', metafn}
|
|
,
|
|
{SPEC | 'd', (fn_t) backchar}
|
|
,
|
|
{SPEC | 'e', (fn_t) forwline}
|
|
,
|
|
{SPEC | 'f', (fn_t) gotobob}
|
|
,
|
|
{SPEC | 'h', help}
|
|
,
|
|
{SPEC | 'i', cex}
|
|
,
|
|
#endif
|
|
|
|
{0x7F, backdel}
|
|
,
|
|
|
|
/* special internal bindings */
|
|
{ SPEC | META | 'W', wrapword }, /* called on word wrap */
|
|
{ SPEC | META | 'C', nullproc }, /* every command input */
|
|
{ SPEC | META | 'R', nullproc }, /* on file read */
|
|
{ SPEC | META | 'X', nullproc }, /* on window change P.K. */
|
|
|
|
{0, NULL}
|
|
};
|