1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00
uemacs/ebind.c

438 lines
7.7 KiB
C
Raw Normal View History

/* ebind.c -- implements ebind.h */
#include "ebind.h"
/* ebind.c
*
* Initial default key to function bindings
*
* Modified by Petri Kutvonen
*/
#include <stdlib.h>
2013-05-28 03:10:16 -04:00
#include "basic.h"
2013-05-28 01:04:39 -04:00
#include "bind.h"
2013-10-09 01:43:32 -04:00
#include "estruct.h"
#include "bindable.h"
2013-05-28 01:25:14 -04:00
#include "buffer.h"
2013-05-28 01:35:09 -04:00
#include "eval.h"
2013-05-25 00:37:03 -04:00
#include "exec.h"
2013-05-25 00:28:17 -04:00
#include "file.h"
2013-05-28 00:25:59 -04:00
#include "isearch.h"
#include "line.h"
2013-05-28 00:37:04 -04:00
#include "random.h"
2013-05-28 01:18:47 -04:00
#include "region.h"
2013-05-28 00:22:31 -04:00
#include "search.h"
2013-05-25 00:40:35 -04:00
#include "spawn.h"
2013-05-28 00:47:48 -04:00
#include "window.h"
2013-05-28 00:42:06 -04:00
#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] = {
2016-05-22 10:22:39 -04:00
{CONTROL | 'A', (fn_t) gotobol}
,
2016-05-19 09:27:26 -04:00
{CONTROL | 'B', (fn_t) backchar}
,
{CONTROL | 'C', insspace}
,
{CONTROL | 'D', forwdel}
,
2016-05-22 10:22:39 -04:00
{CONTROL | 'E', (fn_t) gotoeol}
,
2016-05-19 09:27:26 -04:00
{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}
,
2016-05-22 10:22:39 -04:00
{CONTROL | 'N', (fn_t) forwline}
,
{CONTROL | 'O', openline}
,
2016-05-22 10:22:39 -04:00
{CONTROL | 'P', (fn_t) backline}
,
{CONTROL | 'Q', quote}
,
{CONTROL | 'R', backsearch}
,
{CONTROL | 'S', forwsearch}
,
{CONTROL | 'T', (fn_t) twiddle}
,
{CONTROL | 'U', unarg}
,
2016-05-22 10:22:39 -04:00
{CONTROL | 'V', (fn_t) forwpage}
,
{CONTROL | 'W', killregion}
,
{CONTROL | 'X', cex}
,
{CONTROL | 'Y', yank}
,
2016-05-22 10:22:39 -04:00
{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}
,
2016-05-22 10:22:39 -04:00
{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}
,
2016-05-22 10:22:39 -04:00
{META | ' ', (fn_t) setmark}
,
{META | '?', help}
,
{META | '!', reposition}
,
2016-05-22 10:22:39 -04:00
{META | '.', (fn_t) setmark}
,
2016-05-22 10:22:39 -04:00
{META | '>', (fn_t) gotoeob}
,
2016-05-22 10:22:39 -04:00
{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}
,
2016-05-22 10:22:39 -04:00
{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}
,
2016-05-22 10:22:39 -04:00
{SPEC | 71, (fn_t) gotobol}
,
2016-05-22 10:22:39 -04:00
{SPEC | 72, (fn_t) backline}
,
2016-05-22 10:22:39 -04:00
{SPEC | 73, (fn_t) backpage}
,
2016-05-19 09:27:26 -04:00
{SPEC | 75, (fn_t) backchar}
,
2016-05-19 09:27:26 -04:00
{SPEC | 77, (fn_t) forwchar}
,
2016-05-22 10:22:39 -04:00
{SPEC | 79, (fn_t) gotoeol}
,
2016-05-22 10:22:39 -04:00
{SPEC | 80, (fn_t) forwline}
,
2016-05-22 10:22:39 -04:00
{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
2016-05-22 10:22:39 -04:00
{SPEC | 117, (fn_t) gotoeob}
,
2016-05-22 10:22:39 -04:00
{SPEC | 119, (fn_t) gotobob}
,
{SPEC | 141, gotobop}
,
{SPEC | 145, gotoeop}
,
{SPEC | 146, yank}
,
{SPEC | 147, killregion}
,
#endif
#endif
#if VT220
2016-05-22 10:22:39 -04:00
{SPEC | '1', (fn_t) gotobob /* fisearch */}
, /* VT220 keys */
{SPEC | '2', yank}
,
{SPEC | '3', forwdel /* killregion */}
,
2016-05-22 10:22:39 -04:00
{SPEC | '4', (fn_t) gotoeob /* setmark */}
,
2016-05-22 10:22:39 -04:00
{SPEC | '5', (fn_t) backpage}
,
2016-05-22 10:22:39 -04:00
{SPEC | '6', (fn_t) forwpage}
,
2016-05-22 10:22:39 -04:00
{SPEC | 'A', (fn_t) backline}
,
2016-05-22 10:22:39 -04:00
{SPEC | 'B', (fn_t) forwline}
,
2016-05-19 09:27:26 -04:00
{SPEC | 'C', (fn_t) forwchar}
,
2016-05-19 09:27:26 -04:00
{SPEC | 'D', (fn_t) backchar}
,
{SPEC | 'c', metafn}
,
2016-05-19 09:27:26 -04:00
{SPEC | 'd', (fn_t) backchar}
,
2016-05-22 10:22:39 -04:00
{SPEC | 'e', (fn_t) forwline}
,
2016-05-22 10:22:39 -04:00
{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}
};