summaryrefslogtreecommitdiff
path: root/doc/history.3
diff options
context:
space:
mode:
Diffstat (limited to 'doc/history.3')
-rw-r--r--doc/history.334
1 files changed, 25 insertions, 9 deletions
diff --git a/doc/history.3 b/doc/history.3
index 8de64f6..346b661 100644
--- a/doc/history.3
+++ b/doc/history.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Sun Oct 8 11:43:43 EDT 2017
+.\" Last Change: Fri Nov 15 09:39:27 EST 2019
.\"
-.TH HISTORY 3 "2017 October 8" "GNU History 6.3"
+.TH HISTORY 3 "2019 November 15" "GNU History 8.0"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -118,6 +118,8 @@ containing
The trailing \fB?\fP may be omitted if
.I string
is followed immediately by a newline.
+If \fIstring\fP is missing, the string from the most recent search is used;
+it is an error if there is no previous search string.
.TP
.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
Quick substitution. Repeat the last command, replacing
@@ -125,7 +127,7 @@ Quick substitution. Repeat the last command, replacing
with
.IR string2 .
Equivalent to
-``!!:s/\fIstring1\fP/\fIstring2\fP/''
+``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u''
(see \fBModifiers\fP below).
.TP
.B !#
@@ -165,7 +167,8 @@ The last word. This is usually the last argument, but will expand to the
zeroth word if there is only one word in the line.
.TP
.B %
-The word matched by the most recent `?\fIstring\fR?' search.
+The first word matched by the most recent `?\fIstring\fR?' search,
+if the search string begins with a character that is part of a word.
.TP
.I x\fB\-\fPy
A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
@@ -182,6 +185,7 @@ Abbreviates \fIx\-$\fP.
.TP
.B x\-
Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
+If \fBx\fP is missing, it defaults to 0.
.PD
.PP
If a word designator is supplied without an event specification, the
@@ -190,6 +194,7 @@ previous command is used as the event.
.PP
After the optional word designator, there may appear a sequence of
one or more of the following modifiers, each preceded by a `:'.
+These modify, or edit, the word or words selected from the history event.
.PP
.PD 0
.PP
@@ -219,15 +224,19 @@ Quote the substituted words as with
but break into words at
.B blanks
and newlines.
+The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one
+supplied is used.
.TP
.B s/\fIold\fP/\fInew\fP/
Substitute
.I new
for the first occurrence of
.I old
-in the event line. Any delimiter can be used in place of /. The
-final delimiter is optional if it is the last character of the
-event line. The delimiter may be quoted in
+in the event line.
+Any character may be used as the delimiter in place of /.
+The final delimiter is optional if it is the last character of the
+event line.
+The delimiter may be quoted in
.I old
and
.I new
@@ -235,7 +244,8 @@ with a single backslash. If & appears in
.IR new ,
it is replaced by
.IR old .
-A single backslash will quote the &. If
+A single backslash will quote the &.
+If
.I old
is null, it is set to the last
.I old
@@ -245,6 +255,11 @@ the last
in a
.B !?\fIstring\fR\fB[?]\fR
search.
+If
+.I new
+is null, each matching
+.I old
+is deleted.
.TP
.B &
Repeat the previous substitution.
@@ -259,7 +274,8 @@ if it is the last character of the event line.
An \fBa\fP may be used as a synonym for \fBg\fP.
.TP
.B G
-Apply the following `\fBs\fP' modifier once to each word in the event line.
+Apply the following `\fBs\fP' or `\fB&\fP' modifier once to each word
+in the event line.
.PD
.SH "PROGRAMMING WITH HISTORY FUNCTIONS"
This section describes how to use the History library in other programs.