]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - readline/doc/inc-hist.texi
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / readline / doc / inc-hist.texi
CommitLineData
320cd423
SG
1@ignore
2This file is completely identical to hsuser.texinfo, except that it has the
3reference to the programming manual removed. There are definately better ways
4to do this!
5
6This file documents the user interface to the GNU History library.
7
8Copyright (C) 1988, 1991 Free Software Foundation, Inc.
9Authored by Brian Fox.
10
11Permission is granted to make and distribute verbatim copies of this manual
12provided the copyright notice and this permission notice are preserved on
13all copies.
14
15Permission is granted to process this file through Tex and print the
16results, provided the printed document carries copying permission notice
17identical to this one except for the removal of this paragraph (this
18paragraph not being relevant to the printed manual).
19
20Permission is granted to copy and distribute modified versions of this
21manual under the conditions for verbatim copying, provided also that the
22GNU Copyright statement is available to the distributee, and provided that
23the entire resulting derived work is distributed under the terms of a
24permission notice identical to this one.
25
26Permission is granted to copy and distribute translations of this manual
27into another language, under the above conditions for modified versions.
28@end ignore
29
d6229f19 30@node Using History Interactively
b621d050 31@appendix Using History Interactively
320cd423
SG
32
33This chapter describes how to use the GNU History Library interactively,
34from a user's standpoint.
35
36@menu
37* History Interaction:: What it feels like using History as a user.
38@end menu
39
40@node History Interaction
41@section History Interaction
42@cindex expansion
43
f9e903ee
VM
44The History library provides a history expansion feature similar
45to the history expansion in @code{csh}. The following text describes the
46syntax you use to manipulate history information.
47
48History expansion takes two parts. In the first part, determine
49which line from the previous history will be used for substitution.
50This line is called the @dfn{event}.
51In the second part, select portions of that line for inclusion into the
52current line. These portions are called @dfn{words}.
53@value{GDBN} breaks the line into words in the same
54way that the Bash shell does, so that several English (or Unix) words
55surrounded by quotes are considered one word.
320cd423
SG
56
57@menu
58* Event Designators:: How to specify which history line to use.
59* Word Designators:: Specifying which words are of interest.
60* Modifiers:: Modifying the results of susbstitution.
61@end menu
62
63@node Event Designators
64@subsection Event Designators
65@cindex event designators
66
f9e903ee 67An @dfn{event designator} is a reference to a command line entry in the
320cd423
SG
68history list.
69
70@table @asis
71
72@item @code{!}
73Start a history subsititution, except when followed by a space, tab, or
74the end of the line... @key{=} or @key{(}.
75
76@item @code{!!}
77Refer to the previous command. This is a synonym for @code{!-1}.
78
79@item @code{!n}
80Refer to command line @var{n}.
81
82@item @code{!-n}
83Refer to the command line @var{n} lines back.
84
85@item @code{!string}
86Refer to the most recent command starting with @var{string}.
87
88@item @code{!?string}[@code{?}]
89Refer to the most recent command containing @var{string}.
90
91@end table
92
93@node Word Designators
94@subsection Word Designators
95
f9e903ee
VM
96A @key{:} separates the event designator from the @dfn{word designator}.
97It can be omitted if the word designator begins with a @key{^}, @key{$},
320cd423
SG
98@key{*} or @key{%}. Words are numbered from the beginning of the line,
99with the first word being denoted by a 0 (zero).
100
101@table @code
102
103@item 0 (zero)
104The zero'th word. For many applications, this is the command word.
105
106@item n
107The @var{n}'th word.
108
109@item ^
110The first argument. that is, word 1.
111
112@item $
113The last argument.
114
115@item %
116The word matched by the most recent @code{?string?} search.
117
118@item x-y
119A range of words; @code{-@var{y}} Abbreviates @code{0-@var{y}}.
120
121@item *
122All of the words, excepting the zero'th. This is a synonym for @code{1-$}.
123It is not an error to use @key{*} if there is just one word in the event.
124The empty string is returned in that case.
125
126@end table
127
128@node Modifiers
129@subsection Modifiers
130
131After the optional word designator, you can add a sequence of one or more
f9e903ee 132of the following @dfn{modifiers}, each preceded by a @key{:}.
320cd423
SG
133
134@table @code
135
136@item #
137The entire command line typed so far. This means the current command,
f9e903ee
VM
138not the previous command.
139@c
140@c FIXME: If it doesn't belong here, let's put it where it does.
141@c
142@c so it technically isn't a word designator and doesn't belong in
143@c this section.
320cd423
SG
144
145@item h
146Remove a trailing pathname component, leaving only the head.
147
148@item r
149Remove a trailing suffix of the form @samp{.}@var{suffix}, leaving the basename.
150
151@item e
152Remove all but the suffix.
153
154@item t
155Remove all leading pathname components, leaving the tail.
156
157@item p
158Print the new command but do not execute it.
159@end table