summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2005-05-30 13:13:51 +0000
committerJason Wright <jason@cvs.openbsd.org>2005-05-30 13:13:51 +0000
commit0f71813d6df26961349d431f2636f5441fa514cb (patch)
tree270be1432635b9a05b511366ba39571c1b83099d /usr.bin/mg
parent2f1dc810c4a250489c4d71a333fdb9d084dfcda3 (diff)
add find-alternate-file command and binding for ^X^V; ok cloder
(you're welcome kjell)
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/def.h3
-rw-r--r--usr.bin/mg/file.c10
-rw-r--r--usr.bin/mg/funmap.c3
-rw-r--r--usr.bin/mg/keymap.c4
4 files changed, 15 insertions, 5 deletions
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h
index 987f968214a..b426fc01d60 100644
--- a/usr.bin/mg/def.h
+++ b/usr.bin/mg/def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: def.h,v 1.61 2005/05/27 08:08:18 cloder Exp $ */
+/* $OpenBSD: def.h,v 1.62 2005/05/30 13:13:50 jason Exp $ */
#include <sys/queue.h>
@@ -331,6 +331,7 @@ int d_create_directory(int, int);
/* file.c X */
int fileinsert(int, int);
int filevisit(int, int);
+int filevisitalt(int, int);
int filevisitro(int, int);
int poptofile(int, int);
BUFFER *findbuffer(char *);
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index a901f6e8d86..e00a05807e1 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.34 2005/05/27 08:52:30 cloder Exp $ */
+/* $OpenBSD: file.c,v 1.35 2005/05/30 13:13:50 jason Exp $ */
/*
* File commands.
@@ -74,6 +74,14 @@ filevisit(int f, int n)
}
int
+filevisitalt(int f, int n)
+{
+ if (killbuffer(curbp) == ABORT)
+ return (ABORT);
+ return (filevisit(f, n));
+}
+
+int
filevisitro(int f, int n)
{
int error;
diff --git a/usr.bin/mg/funmap.c b/usr.bin/mg/funmap.c
index 07857e7f7ee..e673a3945b4 100644
--- a/usr.bin/mg/funmap.c
+++ b/usr.bin/mg/funmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: funmap.c,v 1.13 2005/05/27 08:08:18 cloder Exp $ */
+/* $OpenBSD: funmap.c,v 1.14 2005/05/30 13:13:50 jason Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
*
@@ -118,6 +118,7 @@ static struct funmap functnames[] = {
{fillpara, "fill-paragraph",},
{filevisit, "find-file",},
{filevisitro, "find-file-read-only",},
+ {filevisitalt, "find-alternate-file",},
{poptofile, "find-file-other-window",},
{forwchar, "forward-char",},
{gotoeop, "forward-paragraph",},
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index 85ec1873048..0235effe9e9 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.28 2005/04/03 02:09:28 db Exp $ */
+/* $OpenBSD: keymap.c,v 1.29 2005/05/30 13:13:50 jason Exp $ */
/*
* Keyboard maps. This is character set dependent. The terminal specific
@@ -84,7 +84,7 @@ static PF cXcL[] = {
filesave, /* ^S */
rescan, /* ^T */
upperregion, /* ^U */
- rescan, /* ^V */
+ filevisitalt, /* ^V */
filewrite, /* ^W */
swapmark /* ^X */
};