Hi,

>From vi(1):

     [range] s[ubstitute] [/pattern/replace/]  [options] [count] [flags]
     [range] & [options] [count] [flags]
     [range] ~ [options] [count] [flags]
             Make substitutions.  The replace field may contain any of the
             following sequences:
             (...snip...)

There are a couple of issues here.

First, the command is "s" and only "s"; trying "substitute" results in
an error.

Additionally &, ~, and the options field remain unexplained.

This diff tries to makes things better. ok?

Index: 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.67
diff -u -p -r1.67 vi.1
--- docs/USD.doc/vi.man/vi.1    15 Jun 2017 06:44:47 -0000      1.67
+++ docs/USD.doc/vi.man/vi.1    15 Jun 2017 08:08:49 -0000
@@ -356,7 +356,7 @@ matches the end of the word.
 .It
 .Sq ~
 matches the replacement part of the last
-.Cm substitute
+.Cm s
 command.
 .El
 .Sh BUFFERS
@@ -2019,7 +2019,7 @@ commands from a file.
 .Pp
 .It Xo
 .Op Ar range
-.Cm s Ns Op Cm ubstitute
+.Cm s
 .Sm off
 .Op / Ar pattern No / Ar replace  No /
 .Sm on
@@ -2041,7 +2041,27 @@ commands from a file.
 .Op Ar count
 .Op Ar flags
 .Xc
-Make substitutions.
+Substitute the regular expression
+.Ar pattern
+with
+.Ar replace .
+When invoked as
+.Cm & ,
+or if
+.Bq Ns / Ns Ar pattern Ns / Ns Ar replace Ns /
+is omitted,
+.Ar pattern
+and
+.Ar replace
+from the most recent
+.Cm s
+command are used.
+.Cm ~
+behaves like
+.Cm & ,
+except the pattern used is the most recent regular expression used by any
+command.
+.Pp
 The
 .Ar replace
 field may contain any of the following sequences:
@@ -2051,13 +2071,13 @@ The text matched by
 .Ar pattern .
 .It Sq \(a~
 The replacement part of the previous
-.Cm substitute
+.Cm s
 command.
 .It Sq %
 If this is the entire
 .Ar replace
 pattern, the replacement part of the previous
-.Cm substitute
+.Cm s
 command.
 .It Sq \e#
 Where
@@ -2082,6 +2102,18 @@ to be converted to uppercase.
 Causes the next character to be converted to uppercase.
 .El
 .Pp
+The
+.Ar options
+field may contain any of the following characters:
+.Bl -tag -width Ds
+.It Sq c
+Prompt for confirmation before each replacement is done.
+.It Sq g
+Replace all instances of
+.Ar pattern
+in a line, not just the first.
+.El
+.Pp
 .It Xo
 .Cm su Ns Op Cm spend Ns
 .Op Cm !\&
@@ -2291,7 +2323,9 @@ Remember the values of the
 and
 .Sq g
 suffixes to the
-.Cm substitute
+.Cm s , &
+and
+.Cm ~
 commands, instead of initializing them as unset for each new command.
 .It Cm escapetime Bq 1
 The tenths of a second

Reply via email to