-.\" $OpenBSD: vi.1,v 1.74 2017/08/22 20:27:18 anton Exp $
+.\" $OpenBSD: vi.1,v 1.75 2018/02/12 01:10:46 schwarze Exp $
.\"
.\" Copyright (c) 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" @(#)vi.1 8.51 (Berkeley) 10/10/96
.\"
-.Dd $Mdocdate: August 22 2017 $
+.Dd $Mdocdate: February 12 2018 $
.Dt VI 1
.Os
.Sh NAME
Display buffers, screens or tags.
.Pp
.It Xo
-.Op Cm Ee Ns
-.Op Cm dit Ns
+.Cm e Ns Op Cm dit Ns | Ns Cm x Ns
.Op Cm !\&
.Op Ar +cmd
.Op Ar file
.Xc
-.It Xo
-.Op Cm Ee Ns
-.Cm x Ns Op Cm !\&
-.Op Ar +cmd
-.Op Ar file
-.Xc
Edit a different file.
.Pp
.It Xo
.Xc
Display and optionally change the file name.
.Pp
-.It Xo
-.Op Cm Ff Ns
-.Cm g
-.Op Ar name
-.Xc
+.It Cm fg Op Ar name
.Nm vi
-mode only.
+only.
Foreground the specified screen.
.Pp
.It Xo
.Cm map Ns Op Cm !\&
.Op Ar lhs rhs
.Xc
-Define or display maps (for
.Nm vi
-only).
+only.
+Define or display maps.
.Pp
.It Xo
.Op Ar line
.Ar file .
.Pp
.It Xo
-.Op Cm Nn Ns
-.Op Cm ext Ns
+.Cm n Ns Op Cm ext Ns
.Op Cm !\&
.Op Ar file ...
.Xc
.Fl r
option.
.Pp
-.It Xo
-.Op Cm \&Pp Ns
-.Cm rev Ns Op Cm ious Ns
-.Op Cm !\&
-.Xc
+.It Cm prev Ns Oo Cm ious Oc Ns Op Cm !\&
Edit the previous file from the argument list.
.Pp
.It Xo
.Op Cm !\&
.Xc
End the editing session.
+In split-screen mode, only close the current screen
+and switch to the previous one.
.Pp
.It Xo
.Op Ar line
.It Xo
.Cm res Ns Op Cm ize
.Op Cm + Ns | Ns Cm - Ns
-.Ar size
+.Ar lines
.Xc
.Nm vi
mode only.
.Aq control-Z .
.Pp
.It Xo
-.Op Cm Tt Ns
-.Cm a Ns Op Cm g Ns
+.Cm ta Ns Op Cm g Ns
.Op Cm !\&
.Ar tagstring
.Xc
.Op Ar flags
.Xc
.Nm ex
-mode only.
+only.
Enter
.Nm vi .
.Pp
.It Xo
-.Op Cm Vi Ns
-.Cm i Ns Op Cm sual Ns
+.Cm vi Ns Op Cm sual Ns
.Op Cm !\&
.Op Ar +cmd
.Op Ar file
.Xc
.Nm vi
-mode only.
+only.
Edit a new file.
.Pp
.It Xo
.Op >>
.Op Ar file
.Xc
-.It Xo
-.Op Ar range
-.Cm w Ns Op Cm rite
-.Op Cm !\&
-.Op Ar file
-.Xc
+Write the file.
+.Pp
.It Xo
.Op Ar range
.Cm wn Ns Op Cm !\&
.Op >>
.Op Ar file
.Xc
+Write the file and edit the next file from the argument list.
+.Pp
.It Xo
.Op Ar range
.Cm wq Ns Op Cm !\&
.Op >>
.Op Ar file
.Xc
-Write the file.
+Write the file and exit the editor.
+In split-screen mode, close the current screen
+and switch to the previous one.
.Pp
.It Xo
.Op Ar range
.Xc
Exit the editor,
writing the file if it has been modified.
+In split-screen mode, close the current screen
+and switch to the previous one.
.Pp
.It Xo
.Op Ar range
.Xc
Adjust the window.
.El
+.Pp
+For
+.Cm e ,
+.Cm fg ,
+.Cm n ,
+.Cm prev ,
+.Cm ta ,
+and
+.Cm vi ,
+if the first letter of the command is capitalized, the current screen is
+split and the new file is displayed in addition to the current screen.
+This feature is only available in
+.Nm vi ,
+not in
+.Nm ex .
.Sh SET OPTIONS
There are a large number of options that may be set
.Pq or unset
-/* $OpenBSD: ex_cmd.c,v 1.10 2015/11/19 07:53:31 bentley Exp $ */
+/* $OpenBSD: ex_cmd.c,v 1.11 2018/02/12 01:10:46 schwarze Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
{"bg", ex_bg, E_VIONLY,
"",
"bg",
- "put a foreground screen into the background"},
+ "put the current screen into the background"},
/* C_CHANGE */
{"change", ex_change, E_ADDR2|E_ADDR_ZERODEF,
"!ca",
/* C_EDIT */
{"edit", ex_edit, E_NEWSCREEN,
"f1o",
- "[Ee][dit][!] [+cmd] [file]",
+ "e[dit][!] [+cmd] [file]",
"begin editing another file"},
/* C_EX */
{"ex", ex_edit, E_NEWSCREEN,
"f1o",
- "[Ee]x[!] [+cmd] [file]",
+ "ex[!] [+cmd] [file]",
"begin editing another file"},
/* C_EXUSAGE */
{"exusage", ex_usage, 0,
/* C_FG */
{"fg", ex_fg, E_NEWSCREEN|E_VIONLY,
"f1o",
- "[Ff]g [file]",
+ "fg [file]",
"bring a backgrounded screen into the foreground"},
/* C_GLOBAL */
{"global", ex_global, E_ADDR2_ALL,
/* C_NEXT */
{"next", ex_next, E_NEWSCREEN,
"!fN",
- "[Nn][ext][!] [+cmd] [file ...]",
+ "n[ext][!] [+cmd] [file ...]",
"edit (and optionally specify) the next file"},
/* C_NUMBER */
{"number", ex_number, E_ADDR2|E_CLRFLAG,
/* C_PREVIOUS */
{"previous", ex_prev, E_NEWSCREEN,
"!",
- "[Pp]rev[ious][!]",
+ "prev[ious][!]",
"edit the previous file in the file argument list"},
/* C_PUT */
{"put", ex_put,
{"quit", ex_quit, 0,
"!",
"q[uit][!]",
- "exit ex/vi"},
+ "exit ex/vi or close the current screen"},
/* C_READ */
{"read", ex_read, E_ADDR1|E_ADDR_ZERO|E_ADDR_ZERODEF,
"s",
/* C_TAG */
{"tag", ex_tag_push, E_NEWSCREEN,
"!w1o",
- "[Tt]a[g][!] [string]",
+ "ta[g][!] [string]",
"edit the file containing the tag"},
/* C_TAGNEXT */
{"tagnext", ex_tag_next, 0,
/* C_VISUAL_VI */
{"visual", ex_edit, E_NEWSCREEN,
"f1o",
- "[Vv]i[sual][!] [+cmd] [file]",
+ "vi[sual][!] [+cmd] [file]",
"edit another file (from vi mode only)"},
/* C_VIUSAGE */
{"viusage", ex_viusage, 0,
{"xit", ex_xit, E_ADDR2_ALL|E_ADDR_ZERODEF,
"!f1o",
"[line [,line]] x[it][!] [file]",
- "exit"},
+ "write if modified and exit"},
/* C_YANK */
{"yank", ex_yank, E_ADDR2,
"bca",
-/* $OpenBSD: ex_usage.c,v 1.8 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_usage.c,v 1.9 2018/02/12 01:10:46 schwarze Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
ARGS *ap;
EXCMDLIST const *cp;
int newscreen;
- char *name, *p, nb[MAXCMDNAMELEN + 5];
+ char *p;
switch (cmdp->argc) {
case 1:
}
break;
case 0:
- for (cp = cmds; cp->name != NULL && !INTERRUPTED(sp); ++cp) {
- /*
- * The ^D command has an unprintable name.
- *
- * XXX
- * We display both capital and lower-case versions of
- * the appropriate commands -- no need to add in extra
- * room, they're all short names.
- */
- if (cp == &cmds[C_SCROLL])
- name = "^D";
- else if (F_ISSET(cp, E_NEWSCREEN)) {
- nb[0] = '[';
- nb[1] = toupper(cp->name[0]);
- nb[2] = cp->name[0];
- nb[3] = ']';
- for (name = cp->name + 1,
- p = nb + 4; (*p++ = *name++) != '\0';);
- name = nb;
- } else
- name = cp->name;
- (void)ex_printf(sp,
- "%*s: %s\n", MAXCMDNAMELEN, name, cp->help);
- }
+ for (cp = cmds; cp->name != NULL && !INTERRUPTED(sp); ++cp)
+ (void)ex_printf(sp, "%*s: %s\n", MAXCMDNAMELEN,
+ /* The ^D command has an unprintable name. */
+ cp == &cmds[C_SCROLL] ? "^D" : cp->name,
+ cp->help);
break;
default:
abort();