add a C-c target, so we can use it as a prefix for keybindings.
authorkjell <kjell@openbsd.org>
Wed, 27 Aug 2008 04:11:52 +0000 (04:11 +0000)
committerkjell <kjell@openbsd.org>
Wed, 27 Aug 2008 04:11:52 +0000 (04:11 +0000)
Now you can do something like:
  global-set-key "\^c\^c" compile
in your ~/.mg

usr.bin/mg/keymap.c

index 10ebb85..4918a14 100644 (file)
@@ -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 */
                {