-/* $OpenBSD: dired.c,v 1.102 2023/03/08 04:43:11 guenther Exp $ */
+/* $OpenBSD: dired.c,v 1.103 2024/06/04 06:48:34 op Exp $ */
/* This file is in the public domain. */
static int d_undel(int, int);
static int d_undelbak(int, int);
static int d_findfile(int, int);
+static int d_updirectory(int, int);
static int d_ffotherwindow(int, int);
static int d_expunge(int, int);
static int d_copy(int, int);
d_create_directory /* + */
};
+static PF diredcaret[] = {
+ d_updirectory /* ^ */
+};
+
static PF direda[] = {
d_filevisitalt, /* a */
rescan, /* b */
}
};
-static struct KEYMAPE (7) diredmap = {
- 7,
- 7,
+static struct KEYMAPE (8) diredmap = {
+ 8,
+ 8,
rescan,
{
{
{
CCHR('Z'), '+', diredcz, (KEYMAP *) & metamap
},
+ {
+ '^', '^', diredcaret, NULL
+ },
{
'a', 'j', direda, NULL
},
funmap_add(d_undel, "dired-unmark", 0);
funmap_add(d_undelbak, "dired-unmark-backward", 0);
funmap_add(d_killbuffer_cmd, "quit-window", 0);
+ funmap_add(d_updirectory, "dired-up-directory", 0);
maps_add((KEYMAP *)&diredmap, "dired");
dobindkey(fundamental_map, "dired", "^Xd");
}
return (readin(fname));
}
+int
+d_updirectory(int f, int n)
+{
+ struct buffer *bp;
+ int ret;
+ char fname[NFILEN];
+
+ ret = snprintf(fname, sizeof(fname), "%s..", curbp->b_fname);
+ if (ret < 0 || (size_t)ret >= sizeof(fname))
+ return (ABORT); /* Name is too long. */
+
+ bp = dired_(fname);
+ if (bp == NULL)
+ return (FALSE);
+ curbp = bp;
+ if (showbuffer(bp, curwp, WFFULL) != TRUE)
+ return (FALSE);
+ if (bp->b_fname[0] != 0)
+ return (TRUE);
+ return (readin(fname));
+}
+
int
d_ffotherwindow(int f, int n)
{
-.\" $OpenBSD: mg.1,v 1.136 2023/10/16 08:33:16 op Exp $
+.\" $OpenBSD: mg.1,v 1.137 2024/06/04 06:48:34 op Exp $
.\" This file is in the public domain.
.\"
-.Dd $Mdocdate: October 16 2023 $
+.Dd $Mdocdate: June 4 2024 $
.Dt MG 1
.Os
.Sh NAME
dired-shell-command
.It +
dired-create-directory
+.It ^
+dired-up-directory
.It a
dired-find-alternate-file
.It c
.It Ic dired-unmark-backward
Remove the deletion flag from the file listed on the previous line
of the dired buffer, then move up to that line.
+.It Ic dired-up-directory
+Open a dired buffer in the parent directory.
.It Ic quit-window
Close the current dired buffer.
.El