Hello! Here's a diff that adds explicit .Tg macros to vi(1), so that
you can jump to vi or ex commands using -Otag or :t. This patch
*should* include every command, but I couldn't figure out how to tag the
'!' and ':!' commands; none of these worked:
.Tg
.Tg !
.Tg !\&
.Tg "!"
This patch doesn't tag special keys either (word erase, literal next,
etc.), because tag names can't contain whitespace and I'd prefer
consistency with the manpage. One solution would be to say WERASE and
LNEXT instead, which is what ksh(1) does, and this also makes it easier
to lookup what 'word erase' and 'literal next' really are.
$ man -k Dv=WERASE Dv=LNEXT
stty(1) - set the options for a terminal device interface
termios(4) - general terminal line discipline
$ man 4 termios -Otag=WERASE
WERASESpecial character on input and is recognized if the ICANON
flag is set. Erases the last word ...
If a line is explicitly tagged with the .Tg macro, mandoc removes any
other automatically-created tags with the same name. So this patch also
explicitly tags the 'print', 'number', and 'list' options and the
[-ceFRrSstvw] flags.
Comments? OK?
Index: src/usr.bin/vi/docs/USD.doc/vi.man/vi.1
===
RCS file: /cvs/src/usr.bin/vi/docs/USD.doc/vi.man/vi.1,v
retrieving revision 1.79
diff -u -p -r1.79 vi.1
--- src/usr.bin/vi/docs/USD.doc/vi.man/vi.1 8 Mar 2021 02:47:29 -
1.79
+++ src/usr.bin/vi/docs/USD.doc/vi.man/vi.1 20 Nov 2021 23:05:26 -
@@ -87,6 +87,7 @@ It's probably enough to get you going.
.Pp
The following options are available:
.Bl -tag -width "-w size "
+.Tg c
.It Fl c Ar cmd
Execute
.Ar cmd
@@ -99,19 +100,23 @@ This is the POSIX 1003.2 interface for t
syntax.
.Nm nex Ns / Ns Nm nvi
supports both the old and new syntax.
+.Tg e
.It Fl e
Start editing in ex mode, as if the command name were
.Nm ex .
+.Tg F
.It Fl F
Don't copy the entire file when first starting to edit.
(The default is to make a copy in case someone else modifies
the file during your edit session.)
+.Tg R
.It Fl R
Start editing in read-only mode, as if the command name was
.Nm view ,
or the
.Cm readonly
option was set.
+.Tg r
.It Fl r
Recover the specified files or, if no files are specified,
list the files that could be recovered.
@@ -119,10 +124,12 @@ If no recoverable files by the specified
the file is edited as if the
.Fl r
option had not been specified.
+.Tg S
.It Fl S
Run with the
.Cm secure
edit option set, disallowing all access to external programs.
+.Tg s
.It Fl s
Enter batch mode; applicable only to
.Nm ex
@@ -137,14 +144,17 @@ This is the POSIX 1003.2 interface for t
argument.
.Nm nex Ns / Ns Nm nvi
supports both the old and new syntax.
+.Tg t
.It Fl t Ar tag
Start editing at the specified
.Ar tag
(see
.Xr ctags 1 ) .
+.Tg v
.It Fl v
Start editing in vi mode, as if the command name was
.Nm vi .
+.Tg w
.It Fl w Ar size
Set the initial window size to the specified number of lines.
.El
@@ -553,6 +563,7 @@ and considered part of the motion.
.Pp
.Bl -tag -width Ds -compact
.It Xo
+.Tg control-A
.Aq Cm control-A
.Xc
Search forward
@@ -560,6 +571,7 @@ for the word starting at the cursor posi
.Pp
.It Xo
.Op Ar count
+.Tg control-B
.Aq Cm control-B
.Xc
Page backwards
@@ -569,6 +581,7 @@ Two lines of overlap are maintained, if
.Pp
.It Xo
.Op Ar count
+.Tg control-D
.Aq Cm control-D
.Xc
Scroll forward
@@ -587,6 +600,7 @@ command, scroll half the number of lines
.Pp
.It Xo
.Op Ar count
+.Tg control-E
.Aq Cm control-E
.Xc
Scroll forward
@@ -595,6 +609,7 @@ lines, leaving the current line and colu
.Pp
.It Xo
.Op Ar count
+.Tg control-F
.Aq Cm control-F
.Xc
Page forward
@@ -602,6 +617,7 @@ Page forward
screens.
Two lines of overlap are maintained, if possible.
.Pp
+.Tg control-G
.It Aq Cm control-G
Display the following file information:
the file name (as given to
@@ -614,10 +630,12 @@ and the current line number as a percent
.Pp
.It Xo
.Op Ar count
+.Tg control-H
.Aq Cm control-H
.Xc
.It Xo
.Op Ar count
+.Tg
.Cm h
.Xc
Move the cursor back
@@ -626,30 +644,37 @@ characters in the current line.
.Pp
.It Xo
.Op Ar count
+.Tg control-J
.Aq Cm control-J
.Xc
.It Xo
.Op Ar count
+.Tg control-N
.Aq Cm control-N
.Xc
.It Xo
.Op Ar count
+.Tg
.Cm j
.Xc
Move the cursor down
.Ar count
lines without changing the current column.
.Pp
+.Tg control-L
.It Aq Cm control-L
+.Tg control-R
.It Aq Cm control-R
Repaint the screen.
.Pp
.It Xo
.Op Ar count
+.Tg control-M
.Aq Cm control-M
.Xc
.It Xo
.Op Ar count
+.Tg
.Cm +
.Xc
Move the cursor down
@@ -658,21 +683,25 @@ lines to the first non-blank character o
.Pp
.It Xo
.Op Ar count
+.Tg control-P
.Aq Cm control-P
.Xc
.It Xo
.Op Ar count
+.Tg
.Cm k
.Xc
Move the cursor up
.Ar count
lines, without changing the current column.
.Pp
+.Tg control-T
.It Aq Cm control-T
Return to the most