2013-05-31 01:04:52 -04:00
|
|
|
/* ebind.c -- implements ebind.h */
|
|
|
|
#include "ebind.h"
|
|
|
|
|
2013-10-08 22:48:00 -04:00
|
|
|
/* ebind.c
|
2010-06-29 23:08:45 -04:00
|
|
|
*
|
2013-10-08 22:48:00 -04:00
|
|
|
* Initial default key to function bindings
|
2005-05-31 11:50:56 -04:00
|
|
|
*
|
2013-10-08 22:48:00 -04:00
|
|
|
* Modified by Petri Kutvonen
|
2005-05-31 11:50:56 -04:00
|
|
|
*/
|
|
|
|
|
2013-10-08 21:43:15 -04:00
|
|
|
#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"
|
2013-06-04 23:48:40 -04:00
|
|
|
#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"
|
2010-11-14 21:10:03 -05:00
|
|
|
#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"
|
2010-11-14 21:10:03 -05:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2010-06-29 23:08:45 -04:00
|
|
|
struct key_tab keytab[NBINDS] = {
|
2016-05-22 10:22:39 -04:00
|
|
|
{CONTROL | 'A', (fn_t) gotobol}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-19 09:27:26 -04:00
|
|
|
{CONTROL | 'B', (fn_t) backchar}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{CONTROL | 'C', insspace}
|
|
|
|
,
|
|
|
|
{CONTROL | 'D', forwdel}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{CONTROL | 'E', (fn_t) gotoeol}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-19 09:27:26 -04:00
|
|
|
{CONTROL | 'F', (fn_t) forwchar}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{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}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{CONTROL | 'O', openline}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{CONTROL | 'P', (fn_t) backline}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{CONTROL | 'Q', quote}
|
|
|
|
,
|
|
|
|
{CONTROL | 'R', backsearch}
|
|
|
|
,
|
|
|
|
{CONTROL | 'S', forwsearch}
|
|
|
|
,
|
2016-05-20 08:42:37 -04:00
|
|
|
{CONTROL | 'T', (fn_t) twiddle}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{CONTROL | 'U', unarg}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{CONTROL | 'V', (fn_t) forwpage}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{CONTROL | 'W', killregion}
|
|
|
|
,
|
|
|
|
{CONTROL | 'X', cex}
|
|
|
|
,
|
|
|
|
{CONTROL | 'Y', yank}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{CONTROL | 'Z', (fn_t) backpage}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{CONTROL | ']', metafn}
|
|
|
|
,
|
|
|
|
{CTLX | CONTROL | 'B', listbuffers}
|
|
|
|
,
|
|
|
|
{CTLX | CONTROL | 'C', quit}
|
|
|
|
, /* Hard quit. */
|
|
|
|
#if PKCODE & AEDIT
|
|
|
|
{CTLX | CONTROL | 'A', detab}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
#if PKCODE
|
|
|
|
{CTLX | CONTROL | 'D', filesave}
|
|
|
|
, /* alternative */
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
2013-10-08 22:48:00 -04:00
|
|
|
#if AEDIT
|
|
|
|
{CTLX | CONTROL | 'D', detab}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
#if AEDIT
|
|
|
|
{CTLX | CONTROL | 'E', entab}
|
|
|
|
,
|
2005-09-30 18:26:09 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{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}
|
|
|
|
,
|
2005-09-30 18:26:09 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{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}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{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}
|
|
|
|
,
|
2005-09-30 18:26:09 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{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 */
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
#if ISRCH
|
|
|
|
{CTLX | 'R', risearch}
|
|
|
|
,
|
|
|
|
{CTLX | 'S', fisearch}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{CTLX | 'W', resize}
|
|
|
|
,
|
|
|
|
{CTLX | 'X', nextbuffer}
|
|
|
|
,
|
|
|
|
{CTLX | 'Z', enlargewind}
|
|
|
|
,
|
|
|
|
#if WORDPRO
|
|
|
|
{META | CONTROL | 'C', wordcount}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
#if PKCODE
|
|
|
|
{META | CONTROL | 'D', newsize}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
#if PROC
|
|
|
|
{META | CONTROL | 'E', execproc}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
#if CFENCE
|
|
|
|
{META | CONTROL | 'F', getfence}
|
|
|
|
,
|
2005-09-30 18:26:09 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{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}
|
|
|
|
,
|
2005-09-30 18:26:09 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{META | CONTROL | 'Z', scrnextup}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{META | ' ', (fn_t) setmark}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{META | '?', help}
|
|
|
|
,
|
|
|
|
{META | '!', reposition}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{META | '.', (fn_t) setmark}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{META | '>', (fn_t) gotoeob}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{META | '<', (fn_t) gotobob}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{META | '~', unmark}
|
|
|
|
,
|
|
|
|
#if APROP
|
|
|
|
{META | 'A', apro}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{META | 'B', backword}
|
|
|
|
,
|
|
|
|
{META | 'C', capword}
|
|
|
|
,
|
|
|
|
{META | 'D', delfword}
|
|
|
|
,
|
|
|
|
{META | 'F', forwword}
|
|
|
|
,
|
|
|
|
{META | 'G', gotoline}
|
|
|
|
,
|
|
|
|
#if PKCODE
|
|
|
|
#if WORDPRO
|
|
|
|
{META | 'J', justpara}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{META | 'K', bindtokey}
|
|
|
|
,
|
|
|
|
{META | 'L', lowerword}
|
|
|
|
,
|
|
|
|
{META | 'M', setgmode}
|
|
|
|
,
|
|
|
|
#if WORDPRO
|
|
|
|
{META | 'N', gotoeop}
|
|
|
|
,
|
|
|
|
{META | 'P', gotobop}
|
|
|
|
,
|
|
|
|
{META | 'Q', fillpara}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{META | 'R', sreplace}
|
|
|
|
,
|
|
|
|
#if PKCODE
|
2015-09-30 19:38:41 -04:00
|
|
|
{META | 'S', forwhunt}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
2013-10-08 22:48:00 -04:00
|
|
|
#if BSD
|
|
|
|
{META | 'S', bktoshell}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
|
|
|
#endif
|
2013-10-08 22:48:00 -04:00
|
|
|
{META | 'U', upperword}
|
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{META | 'V', (fn_t) backpage}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{META | 'W', copyregion}
|
|
|
|
,
|
|
|
|
{META | 'X', namedcmd}
|
|
|
|
,
|
|
|
|
{META | 'Z', quickexit}
|
|
|
|
,
|
|
|
|
{META | 0x7F, delbword}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2013-10-08 22:48:00 -04:00
|
|
|
#if VT220
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | '1', (fn_t) gotobob /* fisearch */}
|
2013-10-08 22:48:00 -04:00
|
|
|
, /* VT220 keys */
|
|
|
|
{SPEC | '2', yank}
|
|
|
|
,
|
2013-10-10 05:46:13 -04:00
|
|
|
{SPEC | '3', forwdel /* killregion */}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | '4', (fn_t) gotoeob /* setmark */}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | '5', (fn_t) backpage}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | '6', (fn_t) forwpage}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | 'A', (fn_t) backline}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | 'B', (fn_t) forwline}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-19 09:27:26 -04:00
|
|
|
{SPEC | 'C', (fn_t) forwchar}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-19 09:27:26 -04:00
|
|
|
{SPEC | 'D', (fn_t) backchar}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{SPEC | 'c', metafn}
|
|
|
|
,
|
2016-05-19 09:27:26 -04:00
|
|
|
{SPEC | 'd', (fn_t) backchar}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | 'e', (fn_t) forwline}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
2016-05-22 10:22:39 -04:00
|
|
|
{SPEC | 'f', (fn_t) gotobob}
|
2013-10-08 22:48:00 -04:00
|
|
|
,
|
|
|
|
{SPEC | 'h', help}
|
|
|
|
,
|
|
|
|
{SPEC | 'i', cex}
|
|
|
|
,
|
2005-09-30 18:26:09 -04:00
|
|
|
#endif
|
|
|
|
|
2013-10-08 22:48:00 -04:00
|
|
|
{0x7F, backdel}
|
|
|
|
,
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2013-10-08 22:48:00 -04:00
|
|
|
/* 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. */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2013-10-08 22:48:00 -04:00
|
|
|
{0, NULL}
|
2005-05-31 11:50:56 -04:00
|
|
|
};
|