From 04585db0fcf798e27709487f2810fc2ff78f1520 Mon Sep 17 00:00:00 2001 From: kjell Date: Wed, 27 Aug 2008 04:11:52 +0000 Subject: [PATCH] add a C-c target, so we can use it as a prefix for keybindings. Now you can do something like: global-set-key "\^c\^c" compile in your ~/.mg --- usr.bin/mg/keymap.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c index 10ebb85ca00..4918a14007c 100644 --- a/usr.bin/mg/keymap.c +++ b/usr.bin/mg/keymap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keymap.c,v 1.42 2008/06/14 08:46:30 kjell Exp $ */ +/* $OpenBSD: keymap.c,v 1.43 2008/08/27 04:11:52 kjell Exp $ */ /* This file is in the public domain. */ @@ -41,6 +41,18 @@ struct KEYMAPE (2 + IMAPEXT) helpmap = { }; #endif /* !NO_HELP */ +struct KEYMAPE (1 + IMAPEXT) ccmap = { + 1, + 1 + IMAPEXT, + rescan, + { + { + CCHR('@'), CCHR('@'), (PF[]){ rescan }, NULL + } + } +}; + + static PF cX4cF[] = { poptofile, /* ^f */ ctrlg /* ^g */ @@ -304,11 +316,14 @@ static PF fund_at[] = { setmark, /* ^@ */ gotobol, /* ^A */ backchar, /* ^B */ - rescan, /* ^C */ + NULL, /* ^C */ forwdel, /* ^D */ gotoeol, /* ^E */ forwchar, /* ^F */ ctrlg, /* ^G */ +}; + +static PF fund_h[] = { #ifndef NO_HELP NULL, /* ^H */ #else /* !NO_HELP */ @@ -316,6 +331,7 @@ static PF fund_at[] = { #endif /* !NO_HELP */ }; + /* ^I is selfinsert */ static PF fund_CJ[] = { lfindent, /* ^J */ @@ -357,18 +373,21 @@ static PF fund_cb[] = { #define NFUND_XMAPS 0 /* extra map sections after normal ones */ #endif -static struct KEYMAPE (5 + NFUND_XMAPS + IMAPEXT) fundmap = { - 5 + NFUND_XMAPS, - 5 + NFUND_XMAPS + IMAPEXT, +static struct KEYMAPE (6 + NFUND_XMAPS + IMAPEXT) fundmap = { + 6 + NFUND_XMAPS, + 6 + NFUND_XMAPS + IMAPEXT, selfinsert, { + { + CCHR('@'), CCHR('G'), fund_at, (KEYMAP *) & ccmap + }, #ifndef NO_HELP { - CCHR('@'), CCHR('H'), fund_at, (KEYMAP *) & helpmap + CCHR('H'), CCHR('H'), fund_h, (KEYMAP *) & helpmap }, #else /* !NO_HELP */ { - CCHR('@'), CCHR('H'), fund_at, NULL + CCHR('@'), CCHR('H'), fund_h, NULL }, #endif /* !NO_HELP */ { -- 2.20.1