1 |
578 |
markom |
.\"
|
2 |
|
|
.\" MAN PAGE COMMENTS to
|
3 |
|
|
.\"
|
4 |
|
|
.\" Chet Ramey
|
5 |
|
|
.\" Information Network Services
|
6 |
|
|
.\" Case Western Reserve University
|
7 |
|
|
.\" chet@ins.CWRU.Edu
|
8 |
|
|
.\"
|
9 |
|
|
.\" Last Change: Tue Jun 1 13:28:03 EDT 1999
|
10 |
|
|
.\"
|
11 |
|
|
.TH READLINE 3 "1999 Jun 1" GNU
|
12 |
|
|
.\"
|
13 |
|
|
.\" File Name macro. This used to be `.PN', for Path Name,
|
14 |
|
|
.\" but Sun doesn't seem to like that very much.
|
15 |
|
|
.\"
|
16 |
|
|
.de FN
|
17 |
|
|
\fI\|\\$1\|\fP
|
18 |
|
|
..
|
19 |
|
|
.SH NAME
|
20 |
|
|
readline \- get a line from a user with editing
|
21 |
|
|
.SH SYNOPSIS
|
22 |
|
|
.LP
|
23 |
|
|
.nf
|
24 |
|
|
.ft B
|
25 |
|
|
#include
|
26 |
|
|
#include
|
27 |
|
|
#include
|
28 |
|
|
.ft
|
29 |
|
|
.fi
|
30 |
|
|
.LP
|
31 |
|
|
.nf
|
32 |
|
|
.ft B
|
33 |
|
|
char *readline (prompt)
|
34 |
|
|
char *prompt;
|
35 |
|
|
.ft
|
36 |
|
|
.fi
|
37 |
|
|
.SH COPYRIGHT
|
38 |
|
|
.if n Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc.
|
39 |
|
|
.if t Readline is Copyright \(co 1989, 1991, 1993, 1995, 1996 by the Free Software Foundation, Inc.
|
40 |
|
|
.SH DESCRIPTION
|
41 |
|
|
.LP
|
42 |
|
|
.B readline
|
43 |
|
|
will read a line from the terminal
|
44 |
|
|
and return it, using
|
45 |
|
|
.B prompt
|
46 |
|
|
as a prompt. If
|
47 |
|
|
.B prompt
|
48 |
|
|
is null, no prompt is issued. The line returned is allocated with
|
49 |
|
|
.IR malloc (3),
|
50 |
|
|
so the caller must free it when finished. The line returned
|
51 |
|
|
has the final newline removed, so only the text of the line
|
52 |
|
|
remains.
|
53 |
|
|
.LP
|
54 |
|
|
.B readline
|
55 |
|
|
offers editing capabilities while the user is entering the
|
56 |
|
|
line.
|
57 |
|
|
By default, the line editing commands
|
58 |
|
|
are similar to those of emacs.
|
59 |
|
|
A vi\-style line editing interface is also available.
|
60 |
|
|
.SH RETURN VALUE
|
61 |
|
|
.LP
|
62 |
|
|
.B readline
|
63 |
|
|
returns the text of the line read. A blank line
|
64 |
|
|
returns the empty string. If
|
65 |
|
|
.B EOF
|
66 |
|
|
is encountered while reading a line, and the line is empty,
|
67 |
|
|
.B NULL
|
68 |
|
|
is returned. If an
|
69 |
|
|
.B EOF
|
70 |
|
|
is read with a non\-empty line, it is
|
71 |
|
|
treated as a newline.
|
72 |
|
|
.SH NOTATION
|
73 |
|
|
.LP
|
74 |
|
|
An emacs-style notation is used to denote
|
75 |
|
|
keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
|
76 |
|
|
means Control\-N. Similarly,
|
77 |
|
|
.I meta
|
78 |
|
|
keys are denoted by M\-\fIkey\fR, so M\-x means Meta\-X. (On keyboards
|
79 |
|
|
without a
|
80 |
|
|
.I meta
|
81 |
|
|
key, M\-\fIx\fP means ESC \fIx\fP, i.e., press the Escape key
|
82 |
|
|
then the
|
83 |
|
|
.I x
|
84 |
|
|
key. This makes ESC the \fImeta prefix\fP.
|
85 |
|
|
The combination M\-C\-\fIx\fP means ESC\-Control\-\fIx\fP,
|
86 |
|
|
or press the Escape key
|
87 |
|
|
then hold the Control key while pressing the
|
88 |
|
|
.I x
|
89 |
|
|
key.)
|
90 |
|
|
.PP
|
91 |
|
|
Readline commands may be given numeric
|
92 |
|
|
.IR arguments ,
|
93 |
|
|
which normally act as a repeat count. Sometimes, however, it is the
|
94 |
|
|
sign of the argument that is significant. Passing a negative argument
|
95 |
|
|
to a command that acts in the forward direction (e.g., \fBkill\-line\fP)
|
96 |
|
|
causes that command to act in a backward direction. Commands whose
|
97 |
|
|
behavior with arguments deviates from this are noted.
|
98 |
|
|
.PP
|
99 |
|
|
When a command is described as \fIkilling\fP text, the text
|
100 |
|
|
deleted is saved for possible future retrieval
|
101 |
|
|
(\fIyanking\fP). The killed text is saved in a
|
102 |
|
|
\fIkill ring\fP. Consecutive kills cause the text to be
|
103 |
|
|
accumulated into one unit, which can be yanked all at once.
|
104 |
|
|
Commands which do not kill text separate the chunks of text
|
105 |
|
|
on the kill ring.
|
106 |
|
|
.SH INITIALIZATION FILE
|
107 |
|
|
.LP
|
108 |
|
|
Readline is customized by putting commands in an initialization
|
109 |
|
|
file (the \fIinputrc\fP file).
|
110 |
|
|
The name of this file is taken from the value of the
|
111 |
|
|
.B INPUTRC
|
112 |
|
|
environment variable. If that variable is unset, the default is
|
113 |
|
|
.IR ~/.inputrc .
|
114 |
|
|
When a program which uses the readline library starts up, the
|
115 |
|
|
init file is read, and the key bindings and variables are set.
|
116 |
|
|
There are only a few basic constructs allowed in the
|
117 |
|
|
readline init file. Blank lines are ignored.
|
118 |
|
|
Lines beginning with a \fB#\fP are comments.
|
119 |
|
|
Lines beginning with a \fB$\fP indicate conditional constructs.
|
120 |
|
|
Other lines denote key bindings and variable settings.
|
121 |
|
|
Each program using this library may add its own commands
|
122 |
|
|
and bindings.
|
123 |
|
|
.PP
|
124 |
|
|
For example, placing
|
125 |
|
|
.RS
|
126 |
|
|
.PP
|
127 |
|
|
M\-Control\-u: universal\-argument
|
128 |
|
|
.RE
|
129 |
|
|
or
|
130 |
|
|
.RS
|
131 |
|
|
C\-Meta\-u: universal\-argument
|
132 |
|
|
.RE
|
133 |
|
|
into the
|
134 |
|
|
.I inputrc
|
135 |
|
|
would make M\-C\-u execute the readline command
|
136 |
|
|
.IR universal\-argument .
|
137 |
|
|
.PP
|
138 |
|
|
The following symbolic character names are recognized while
|
139 |
|
|
processing key bindings:
|
140 |
|
|
.IR RUBOUT ,
|
141 |
|
|
.IR DEL ,
|
142 |
|
|
.IR ESC ,
|
143 |
|
|
.IR LFD ,
|
144 |
|
|
.IR NEWLINE ,
|
145 |
|
|
.IR RET ,
|
146 |
|
|
.IR RETURN ,
|
147 |
|
|
.IR SPC ,
|
148 |
|
|
.IR SPACE ,
|
149 |
|
|
and
|
150 |
|
|
.IR TAB .
|
151 |
|
|
.PP
|
152 |
|
|
In addition to command names, readline allows keys to be bound
|
153 |
|
|
to a string that is inserted when the key is pressed (a \fImacro\fP).
|
154 |
|
|
.PP
|
155 |
|
|
.SS Key Bindings
|
156 |
|
|
.PP
|
157 |
|
|
The syntax for controlling key bindings in the
|
158 |
|
|
.I inputrc
|
159 |
|
|
file is simple. All that is required is the name of the
|
160 |
|
|
command or the text of a macro and a key sequence to which
|
161 |
|
|
it should be bound. The name may be specified in one of two ways:
|
162 |
|
|
as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
|
163 |
|
|
prefixes, or as a key sequence.
|
164 |
|
|
When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP,
|
165 |
|
|
.I keyname
|
166 |
|
|
is the name of a key spelled out in English. For example:
|
167 |
|
|
.sp
|
168 |
|
|
.RS
|
169 |
|
|
Control\-u: universal\-argument
|
170 |
|
|
.br
|
171 |
|
|
Meta\-Rubout: backward\-kill\-word
|
172 |
|
|
.br
|
173 |
|
|
Control\-o: ">&output"
|
174 |
|
|
.RE
|
175 |
|
|
.LP
|
176 |
|
|
In the above example,
|
177 |
|
|
.I C\-u
|
178 |
|
|
is bound to the function
|
179 |
|
|
.BR universal\-argument ,
|
180 |
|
|
.I M-DEL
|
181 |
|
|
is bound to the function
|
182 |
|
|
.BR backward\-kill\-word ,
|
183 |
|
|
and
|
184 |
|
|
.I C\-o
|
185 |
|
|
is bound to run the macro
|
186 |
|
|
expressed on the right hand side (that is, to insert the text
|
187 |
|
|
.I >&output
|
188 |
|
|
into the line).
|
189 |
|
|
.PP
|
190 |
|
|
In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
|
191 |
|
|
.B keyseq
|
192 |
|
|
differs from
|
193 |
|
|
.B keyname
|
194 |
|
|
above in that strings denoting
|
195 |
|
|
an entire key sequence may be specified by placing the sequence
|
196 |
|
|
within double quotes. Some GNU Emacs style key escapes can be
|
197 |
|
|
used, as in the following example.
|
198 |
|
|
.sp
|
199 |
|
|
.RS
|
200 |
|
|
"\eC\-u": universal\-argument
|
201 |
|
|
.br
|
202 |
|
|
"\eC\-x\eC\-r": re\-read\-init\-file
|
203 |
|
|
.br
|
204 |
|
|
"\ee[11~": "Function Key 1"
|
205 |
|
|
.RE
|
206 |
|
|
.PP
|
207 |
|
|
In this example,
|
208 |
|
|
.I C-u
|
209 |
|
|
is again bound to the function
|
210 |
|
|
.BR universal\-argument .
|
211 |
|
|
.I "C-x C-r"
|
212 |
|
|
is bound to the function
|
213 |
|
|
.BR re\-read\-init\-file ,
|
214 |
|
|
and
|
215 |
|
|
.I "ESC [ 1 1 ~"
|
216 |
|
|
is bound to insert the text
|
217 |
|
|
.BR "Function Key 1" .
|
218 |
|
|
The full set of GNU Emacs style escape sequences is
|
219 |
|
|
.RS
|
220 |
|
|
.PD 0
|
221 |
|
|
.TP
|
222 |
|
|
.B \eC\-
|
223 |
|
|
control prefix
|
224 |
|
|
.TP
|
225 |
|
|
.B \eM\-
|
226 |
|
|
meta prefix
|
227 |
|
|
.TP
|
228 |
|
|
.B \ee
|
229 |
|
|
an escape character
|
230 |
|
|
.TP
|
231 |
|
|
.B \e\e
|
232 |
|
|
backslash
|
233 |
|
|
.TP
|
234 |
|
|
.B \e"
|
235 |
|
|
literal "
|
236 |
|
|
.TP
|
237 |
|
|
.B \e'
|
238 |
|
|
literal '
|
239 |
|
|
.RE
|
240 |
|
|
.PD
|
241 |
|
|
.PP
|
242 |
|
|
In addition to the GNU Emacs style escape sequences, a second
|
243 |
|
|
set of backslash escapes is available:
|
244 |
|
|
.RS
|
245 |
|
|
.PD 0
|
246 |
|
|
.TP
|
247 |
|
|
.B \ea
|
248 |
|
|
alert (bell)
|
249 |
|
|
.TP
|
250 |
|
|
.B \eb
|
251 |
|
|
backspace
|
252 |
|
|
.TP
|
253 |
|
|
.B \ed
|
254 |
|
|
delete
|
255 |
|
|
.TP
|
256 |
|
|
.B \ef
|
257 |
|
|
form feed
|
258 |
|
|
.TP
|
259 |
|
|
.B \en
|
260 |
|
|
newline
|
261 |
|
|
.TP
|
262 |
|
|
.B \er
|
263 |
|
|
carriage return
|
264 |
|
|
.TP
|
265 |
|
|
.B \et
|
266 |
|
|
horizontal tab
|
267 |
|
|
.TP
|
268 |
|
|
.B \ev
|
269 |
|
|
vertical tab
|
270 |
|
|
.TP
|
271 |
|
|
.B \e\fInnn\fP
|
272 |
|
|
the character whose ASCII code is the octal value \fInnn\fP
|
273 |
|
|
(one to three digits)
|
274 |
|
|
.TP
|
275 |
|
|
.B \ex\fInnn\fP
|
276 |
|
|
the character whose ASCII code is the hexadecimal value \fInnn\fP
|
277 |
|
|
(one to three digits)
|
278 |
|
|
.RE
|
279 |
|
|
.PD
|
280 |
|
|
.PP
|
281 |
|
|
When entering the text of a macro, single or double quotes should
|
282 |
|
|
be used to indicate a macro definition. Unquoted text
|
283 |
|
|
is assumed to be a function name.
|
284 |
|
|
In the macro body, the backslash escapes described above are expanded.
|
285 |
|
|
Backslash will quote any other character in the macro text,
|
286 |
|
|
including " and '.
|
287 |
|
|
.PP
|
288 |
|
|
.B Bash
|
289 |
|
|
allows the current readline key bindings to be displayed or modified
|
290 |
|
|
with the
|
291 |
|
|
.B bind
|
292 |
|
|
builtin command. The editing mode may be switched during interactive
|
293 |
|
|
use by using the
|
294 |
|
|
.B \-o
|
295 |
|
|
option to the
|
296 |
|
|
.B set
|
297 |
|
|
builtin command. Other programs using this library provide
|
298 |
|
|
similar mechanisms. The
|
299 |
|
|
.I inputrc
|
300 |
|
|
file may be edited and re-read if a program does not provide
|
301 |
|
|
any other means to incorporate new bindings.
|
302 |
|
|
.SS Variables
|
303 |
|
|
.PP
|
304 |
|
|
Readline has variables that can be used to further customize its
|
305 |
|
|
behavior. A variable may be set in the
|
306 |
|
|
.I inputrc
|
307 |
|
|
file with a statement of the form
|
308 |
|
|
.RS
|
309 |
|
|
.PP
|
310 |
|
|
\fBset\fP \fIvariable\-name\fP \fIvalue\fP
|
311 |
|
|
.RE
|
312 |
|
|
.PP
|
313 |
|
|
Except where noted, readline variables can take the values
|
314 |
|
|
.B On
|
315 |
|
|
or
|
316 |
|
|
.BR Off .
|
317 |
|
|
The variables and their default values are:
|
318 |
|
|
.PP
|
319 |
|
|
.PD 0
|
320 |
|
|
.TP
|
321 |
|
|
.B bell\-style (audible)
|
322 |
|
|
Controls what happens when readline wants to ring the terminal bell.
|
323 |
|
|
If set to \fBnone\fP, readline never rings the bell. If set to
|
324 |
|
|
\fBvisible\fP, readline uses a visible bell if one is available.
|
325 |
|
|
If set to \fBaudible\fP, readline attempts to ring the terminal's bell.
|
326 |
|
|
.TP
|
327 |
|
|
.B comment\-begin (``#'')
|
328 |
|
|
The string that is inserted in \fBvi\fP mode when the
|
329 |
|
|
.B insert\-comment
|
330 |
|
|
command is executed.
|
331 |
|
|
This command is bound to
|
332 |
|
|
.B M\-#
|
333 |
|
|
in emacs mode and to
|
334 |
|
|
.B #
|
335 |
|
|
in vi command mode.
|
336 |
|
|
.TP
|
337 |
|
|
.B completion\-ignore\-case (Off)
|
338 |
|
|
If set to \fBOn\fP, readline performs filename matching and completion
|
339 |
|
|
in a case\-insensitive fashion.
|
340 |
|
|
.TP
|
341 |
|
|
.B completion\-query\-items (100)
|
342 |
|
|
This determines when the user is queried about viewing
|
343 |
|
|
the number of possible completions
|
344 |
|
|
generated by the \fBpossible\-completions\fP command.
|
345 |
|
|
It may be set to any integer value greater than or equal to
|
346 |
|
|
zero. If the number of possible completions is greater than
|
347 |
|
|
or equal to the value of this variable, the user is asked whether
|
348 |
|
|
or not he wishes to view them; otherwise they are simply listed
|
349 |
|
|
on the terminal.
|
350 |
|
|
.TP
|
351 |
|
|
.B convert\-meta (On)
|
352 |
|
|
If set to \fBOn\fP, readline will convert characters with the
|
353 |
|
|
eighth bit set to an ASCII key sequence
|
354 |
|
|
by stripping the eighth bit and prepending an
|
355 |
|
|
escape character (in effect, using escape as the \fImeta prefix\fP).
|
356 |
|
|
.TP
|
357 |
|
|
.B disable\-completion (Off)
|
358 |
|
|
If set to \fBOn\fP, readline will inhibit word completion. Completion
|
359 |
|
|
characters will be inserted into the line as if they had been
|
360 |
|
|
mapped to \fBself-insert\fP.
|
361 |
|
|
.TP
|
362 |
|
|
.B editing\-mode (emacs)
|
363 |
|
|
Controls whether readline begins with a set of key bindings similar
|
364 |
|
|
to \fIemacs\fP or \fIvi\fP.
|
365 |
|
|
.B editing\-mode
|
366 |
|
|
can be set to either
|
367 |
|
|
.B emacs
|
368 |
|
|
or
|
369 |
|
|
.BR vi .
|
370 |
|
|
.TP
|
371 |
|
|
.B enable\-keypad (Off)
|
372 |
|
|
When set to \fBOn\fP, readline will try to enable the application
|
373 |
|
|
keypad when it is called. Some systems need this to enable the
|
374 |
|
|
arrow keys.
|
375 |
|
|
.TP
|
376 |
|
|
.B expand\-tilde (Off)
|
377 |
|
|
If set to \fBon\fP, tilde expansion is performed when readline
|
378 |
|
|
attempts word completion.
|
379 |
|
|
.TP
|
380 |
|
|
.B horizontal\-scroll\-mode (Off)
|
381 |
|
|
When set to \fBOn\fP, makes readline use a single line for display,
|
382 |
|
|
scrolling the input horizontally on a single screen line when it
|
383 |
|
|
becomes longer than the screen width rather than wrapping to a new line.
|
384 |
|
|
.TP
|
385 |
|
|
.B input\-meta (Off)
|
386 |
|
|
If set to \fBOn\fP, readline will enable eight-bit input (that is,
|
387 |
|
|
it will not strip the high bit from the characters it reads),
|
388 |
|
|
regardless of what the terminal claims it can support. The name
|
389 |
|
|
.B meta\-flag
|
390 |
|
|
is a synonym for this variable.
|
391 |
|
|
.TP
|
392 |
|
|
.B isearch\-terminators (``C\-[C\-J'')
|
393 |
|
|
The string of characters that should terminate an incremental
|
394 |
|
|
search without subsequently executing the character as a command.
|
395 |
|
|
If this variable has not been given a value, the characters
|
396 |
|
|
\fIESC\fP and \fIC\-J\fP will terminate an incremental search.
|
397 |
|
|
.TP
|
398 |
|
|
.B keymap (emacs)
|
399 |
|
|
Set the current readline keymap. The set of legal keymap names is
|
400 |
|
|
\fIemacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
|
401 |
|
|
vi-command\fP, and
|
402 |
|
|
.IR vi-insert .
|
403 |
|
|
\fIvi\fP is equivalent to \fIvi-command\fP; \fIemacs\fP is
|
404 |
|
|
equivalent to \fIemacs-standard\fP. The default value is
|
405 |
|
|
.IR emacs ;
|
406 |
|
|
the value of
|
407 |
|
|
.B editing\-mode
|
408 |
|
|
also affects the default keymap.
|
409 |
|
|
.TP
|
410 |
|
|
.B mark\-directories (On)
|
411 |
|
|
If set to \fBOn\fP, complete
|
412 |
|
|
appended.
|
413 |
|
|
.TP
|
414 |
|
|
.B mark\-modified\-lines (Off)
|
415 |
|
|
If set to \fBOn\fP, history lines that have been modified are displayed
|
416 |
|
|
with a preceding asterisk (\fB*\fP).
|
417 |
|
|
.TP
|
418 |
|
|
.B output\-meta (Off)
|
419 |
|
|
If set to \fBOn\fP, readline will display characters with the
|
420 |
|
|
eighth bit set directly rather than as a meta-prefixed escape
|
421 |
|
|
sequence.
|
422 |
|
|
.TP
|
423 |
|
|
.B print\-completions\-horizontally (Off)
|
424 |
|
|
If set to \fBOn\fP, readline will display completions with matches
|
425 |
|
|
sorted horizontally in alphabetical order, rather than down the screen.
|
426 |
|
|
.TP
|
427 |
|
|
.B show\-all\-if\-ambiguous (Off)
|
428 |
|
|
This alters the default behavior of the completion functions. If
|
429 |
|
|
set to
|
430 |
|
|
.BR on ,
|
431 |
|
|
words which have more than one possible completion cause the
|
432 |
|
|
matches to be listed immediately instead of ringing the bell.
|
433 |
|
|
.TP
|
434 |
|
|
.B visible\-stats (Off)
|
435 |
|
|
If set to \fBOn\fP, a character denoting a file's type as reported
|
436 |
|
|
by \fBstat\fP(2) is appended to the filename when listing possible
|
437 |
|
|
completions.
|
438 |
|
|
.PD
|
439 |
|
|
.SS Conditional Constructs
|
440 |
|
|
.PP
|
441 |
|
|
Readline implements a facility similar in spirit to the conditional
|
442 |
|
|
compilation features of the C preprocessor which allows key
|
443 |
|
|
bindings and variable settings to be performed as the result
|
444 |
|
|
of tests. There are four parser directives used.
|
445 |
|
|
.IP \fB$if\fP
|
446 |
|
|
The
|
447 |
|
|
.B $if
|
448 |
|
|
construct allows bindings to be made based on the
|
449 |
|
|
editing mode, the terminal being used, or the application using
|
450 |
|
|
readline. The text of the test extends to the end of the line;
|
451 |
|
|
no characters are required to isolate it.
|
452 |
|
|
.RS
|
453 |
|
|
.IP \fBmode\fP
|
454 |
|
|
The \fBmode=\fP form of the \fB$if\fP directive is used to test
|
455 |
|
|
whether readline is in emacs or vi mode.
|
456 |
|
|
This may be used in conjunction
|
457 |
|
|
with the \fBset keymap\fP command, for instance, to set bindings in
|
458 |
|
|
the \fIemacs-standard\fP and \fIemacs-ctlx\fP keymaps only if
|
459 |
|
|
readline is starting out in emacs mode.
|
460 |
|
|
.IP \fBterm\fP
|
461 |
|
|
The \fBterm=\fP form may be used to include terminal-specific
|
462 |
|
|
key bindings, perhaps to bind the key sequences output by the
|
463 |
|
|
terminal's function keys. The word on the right side of the
|
464 |
|
|
.B =
|
465 |
|
|
is tested against the full name of the terminal and the portion
|
466 |
|
|
of the terminal name before the first \fB\-\fP. This allows
|
467 |
|
|
.I sun
|
468 |
|
|
to match both
|
469 |
|
|
.I sun
|
470 |
|
|
and
|
471 |
|
|
.IR sun\-cmd ,
|
472 |
|
|
for instance.
|
473 |
|
|
.IP \fBapplication\fP
|
474 |
|
|
The \fBapplication\fP construct is used to include
|
475 |
|
|
application-specific settings. Each program using the readline
|
476 |
|
|
library sets the \fIapplication name\fP, and an initialization
|
477 |
|
|
file can test for a particular value.
|
478 |
|
|
This could be used to bind key sequences to functions useful for
|
479 |
|
|
a specific program. For instance, the following command adds a
|
480 |
|
|
key sequence that quotes the current or previous word in Bash:
|
481 |
|
|
.sp 1
|
482 |
|
|
.RS
|
483 |
|
|
.nf
|
484 |
|
|
\fB$if\fP bash
|
485 |
|
|
# Quote the current or previous word
|
486 |
|
|
"\eC-xq": "\eeb\e"\eef\e""
|
487 |
|
|
\fB$endif\fP
|
488 |
|
|
.fi
|
489 |
|
|
.RE
|
490 |
|
|
.RE
|
491 |
|
|
.IP \fB$endif\fP
|
492 |
|
|
This command, as seen in the previous example, terminates an
|
493 |
|
|
\fB$if\fP command.
|
494 |
|
|
.IP \fB$else\fP
|
495 |
|
|
Commands in this branch of the \fB$if\fP directive are executed if
|
496 |
|
|
the test fails.
|
497 |
|
|
.IP \fB$include\fP
|
498 |
|
|
This directive takes a single filename as an argument and reads commands
|
499 |
|
|
and bindings from that file. For example, the following directive
|
500 |
|
|
would read \fI/etc/inputrc\fP:
|
501 |
|
|
.sp 1
|
502 |
|
|
.RS
|
503 |
|
|
.nf
|
504 |
|
|
\fB$include\fP \^ \fI/etc/inputrc\fP
|
505 |
|
|
.fi
|
506 |
|
|
.RE
|
507 |
|
|
.SH SEARCHING
|
508 |
|
|
.PP
|
509 |
|
|
Readline provides commands for searching through the command history
|
510 |
|
|
for lines containing a specified string.
|
511 |
|
|
There are two search modes:
|
512 |
|
|
.I incremental
|
513 |
|
|
and
|
514 |
|
|
.IR non-incremental .
|
515 |
|
|
.PP
|
516 |
|
|
Incremental searches begin before the user has finished typing the
|
517 |
|
|
search string.
|
518 |
|
|
As each character of the search string is typed, readline displays
|
519 |
|
|
the next entry from the history matching the string typed so far.
|
520 |
|
|
An incremental search requires only as many characters as needed to
|
521 |
|
|
find the desired history entry.
|
522 |
|
|
The characters present in the value of the \fIisearch-terminators\fP
|
523 |
|
|
variable are used to terminate an incremental search.
|
524 |
|
|
If that variable has not been assigned a value the Escape and
|
525 |
|
|
Control-J characters will terminate an incremental search.
|
526 |
|
|
Control-G will abort an incremental search and restore the original
|
527 |
|
|
line.
|
528 |
|
|
When the search is terminated, the history entry containing the
|
529 |
|
|
search string becomes the current line.
|
530 |
|
|
To find other matching entries in the history list, type Control-S or
|
531 |
|
|
Control-R as appropriate.
|
532 |
|
|
This will search backward or forward in the history for the next
|
533 |
|
|
line matching the search string typed so far.
|
534 |
|
|
Any other key sequence bound to a readline command will terminate
|
535 |
|
|
the search and execute that command.
|
536 |
|
|
For instance, a \fInewline\fP will terminate the search and accept
|
537 |
|
|
the line, thereby executing the command from the history list.
|
538 |
|
|
.PP
|
539 |
|
|
Non-incremental searches read the entire search string before starting
|
540 |
|
|
to search for matching history lines. The search string may be
|
541 |
|
|
typed by the user or be part of the contents of the current line.
|
542 |
|
|
.SH EDITING COMMANDS
|
543 |
|
|
.PP
|
544 |
|
|
The following is a list of the names of the commands and the default
|
545 |
|
|
key sequences to which they are bound.
|
546 |
|
|
Command names without an accompanying key sequence are unbound by default.
|
547 |
|
|
.SS Commands for Moving
|
548 |
|
|
.PP
|
549 |
|
|
.PD 0
|
550 |
|
|
.TP
|
551 |
|
|
.B beginning\-of\-line (C\-a)
|
552 |
|
|
Move to the start of the current line.
|
553 |
|
|
.TP
|
554 |
|
|
.B end\-of\-line (C\-e)
|
555 |
|
|
Move to the end of the line.
|
556 |
|
|
.TP
|
557 |
|
|
.B forward\-char (C\-f)
|
558 |
|
|
Move forward a character.
|
559 |
|
|
.TP
|
560 |
|
|
.B backward\-char (C\-b)
|
561 |
|
|
Move back a character.
|
562 |
|
|
.TP
|
563 |
|
|
.B forward\-word (M\-f)
|
564 |
|
|
Move forward to the end of the next word. Words are composed of
|
565 |
|
|
alphanumeric characters (letters and digits).
|
566 |
|
|
.TP
|
567 |
|
|
.B backward\-word (M\-b)
|
568 |
|
|
Move back to the start of the current or previous word. Words are
|
569 |
|
|
composed of alphanumeric characters (letters and digits).
|
570 |
|
|
.TP
|
571 |
|
|
.B clear\-screen (C\-l)
|
572 |
|
|
Clear the screen leaving the current line at the top of the screen.
|
573 |
|
|
With an argument, refresh the current line without clearing the
|
574 |
|
|
screen.
|
575 |
|
|
.TP
|
576 |
|
|
.B redraw\-current\-line
|
577 |
|
|
Refresh the current line.
|
578 |
|
|
.PD
|
579 |
|
|
.SS Commands for Manipulating the History
|
580 |
|
|
.PP
|
581 |
|
|
.PD 0
|
582 |
|
|
.TP
|
583 |
|
|
.B accept\-line (Newline, Return)
|
584 |
|
|
Accept the line regardless of where the cursor is. If this line is
|
585 |
|
|
non-empty, add it to the history list. If the line is a modified
|
586 |
|
|
history line, then restore the history line to its original state.
|
587 |
|
|
.TP
|
588 |
|
|
.B previous\-history (C\-p)
|
589 |
|
|
Fetch the previous command from the history list, moving back in
|
590 |
|
|
the list.
|
591 |
|
|
.TP
|
592 |
|
|
.B next\-history (C\-n)
|
593 |
|
|
Fetch the next command from the history list, moving forward in the
|
594 |
|
|
list.
|
595 |
|
|
.TP
|
596 |
|
|
.B beginning\-of\-history (M\-<)
|
597 |
|
|
Move to the first line in the history.
|
598 |
|
|
.TP
|
599 |
|
|
.B end\-of\-history (M\->)
|
600 |
|
|
Move to the end of the input history, i.e., the line currently being
|
601 |
|
|
entered.
|
602 |
|
|
.TP
|
603 |
|
|
.B reverse\-search\-history (C\-r)
|
604 |
|
|
Search backward starting at the current line and moving `up' through
|
605 |
|
|
the history as necessary. This is an incremental search.
|
606 |
|
|
.TP
|
607 |
|
|
.B forward\-search\-history (C\-s)
|
608 |
|
|
Search forward starting at the current line and moving `down' through
|
609 |
|
|
the history as necessary. This is an incremental search.
|
610 |
|
|
.TP
|
611 |
|
|
.B non\-incremental\-reverse\-search\-history (M\-p)
|
612 |
|
|
Search backward through the history starting at the current line
|
613 |
|
|
using a non-incremental search for a string supplied by the user.
|
614 |
|
|
.TP
|
615 |
|
|
.B non\-incremental\-forward\-search\-history (M\-n)
|
616 |
|
|
Search forward through the history using a non-incremental search
|
617 |
|
|
for a string supplied by the user.
|
618 |
|
|
.TP
|
619 |
|
|
.B history\-search\-forward
|
620 |
|
|
Search forward through the history for the string of characters
|
621 |
|
|
between the start of the current line and the current cursor
|
622 |
|
|
position (the \fIpoint\fP).
|
623 |
|
|
This is a non-incremental search.
|
624 |
|
|
.TP
|
625 |
|
|
.B history\-search\-backward
|
626 |
|
|
Search backward through the history for the string of characters
|
627 |
|
|
between the start of the current line and the point.
|
628 |
|
|
This is a non-incremental search.
|
629 |
|
|
.TP
|
630 |
|
|
.B yank\-nth\-arg (M\-C\-y)
|
631 |
|
|
Insert the first argument to the previous command (usually
|
632 |
|
|
the second word on the previous line) at point (the current
|
633 |
|
|
cursor position). With an argument
|
634 |
|
|
.IR n ,
|
635 |
|
|
insert the \fIn\fPth word from the previous command (the words
|
636 |
|
|
in the previous command begin with word 0). A negative argument
|
637 |
|
|
inserts the \fIn\fPth word from the end of the previous command.
|
638 |
|
|
.TP
|
639 |
|
|
.B
|
640 |
|
|
yank\-last\-arg (M\-.\^, M\-_\^)
|
641 |
|
|
Insert the last argument to the previous command (the last word of
|
642 |
|
|
the previous history entry). With an argument,
|
643 |
|
|
behave exactly like \fByank\-nth\-arg\fP.
|
644 |
|
|
Successive calls to \fByank\-last\-arg\fP move back through the history
|
645 |
|
|
list, inserting the last argument of each line in turn.
|
646 |
|
|
.PD
|
647 |
|
|
.SS Commands for Changing Text
|
648 |
|
|
.PP
|
649 |
|
|
.PD 0
|
650 |
|
|
.TP
|
651 |
|
|
.B delete\-char (C\-d)
|
652 |
|
|
Delete the character under the cursor. If point is at the
|
653 |
|
|
beginning of the line, there are no characters in the line, and
|
654 |
|
|
the last character typed was not bound to \fBBdelete\-char\fP, then return
|
655 |
|
|
.SM
|
656 |
|
|
.BR EOF .
|
657 |
|
|
.TP
|
658 |
|
|
.B backward\-delete\-char (Rubout)
|
659 |
|
|
Delete the character behind the cursor. When given a numeric argument,
|
660 |
|
|
save the deleted text on the kill ring.
|
661 |
|
|
.TP
|
662 |
|
|
.B forward\-backward\-delete\-char
|
663 |
|
|
Delete the character under the cursor, unless the cursor is at the
|
664 |
|
|
end of the line, in which case the character behind the cursor is
|
665 |
|
|
deleted. By default, this is not bound to a key.
|
666 |
|
|
.TP
|
667 |
|
|
.B quoted\-insert (C\-q, C\-v)
|
668 |
|
|
Add the next character that you type to the line verbatim. This is
|
669 |
|
|
how to insert characters like \fBC\-q\fP, for example.
|
670 |
|
|
.TP
|
671 |
|
|
.B tab\-insert (M-TAB)
|
672 |
|
|
Insert a tab character.
|
673 |
|
|
.TP
|
674 |
|
|
.B self\-insert (a,\ b,\ A,\ 1,\ !,\ ...)
|
675 |
|
|
Insert the character typed.
|
676 |
|
|
.TP
|
677 |
|
|
.B transpose\-chars (C\-t)
|
678 |
|
|
Drag the character before point forward over the character at point.
|
679 |
|
|
Point moves forward as well. If point is at the end of the line, then
|
680 |
|
|
transpose the two characters before point. Negative arguments don't work.
|
681 |
|
|
.TP
|
682 |
|
|
.B transpose\-words (M\-t)
|
683 |
|
|
Drag the word behind the cursor past the word in front of the cursor
|
684 |
|
|
moving the cursor over that word as well.
|
685 |
|
|
.TP
|
686 |
|
|
.B upcase\-word (M\-u)
|
687 |
|
|
Uppercase the current (or following) word. With a negative argument,
|
688 |
|
|
uppercase the previous word, but do not move point.
|
689 |
|
|
.TP
|
690 |
|
|
.B downcase\-word (M\-l)
|
691 |
|
|
Lowercase the current (or following) word. With a negative argument,
|
692 |
|
|
lowercase the previous word, but do not move point.
|
693 |
|
|
.TP
|
694 |
|
|
.B capitalize\-word (M\-c)
|
695 |
|
|
Capitalize the current (or following) word. With a negative argument,
|
696 |
|
|
capitalize the previous word, but do not move point.
|
697 |
|
|
.PD
|
698 |
|
|
.SS Killing and Yanking
|
699 |
|
|
.PP
|
700 |
|
|
.PD 0
|
701 |
|
|
.TP
|
702 |
|
|
.B kill\-line (C\-k)
|
703 |
|
|
Kill the text from the current cursor position to the end of the line.
|
704 |
|
|
.TP
|
705 |
|
|
.B backward\-kill\-line (C\-x Rubout)
|
706 |
|
|
Kill backward to the beginning of the line.
|
707 |
|
|
.TP
|
708 |
|
|
.B unix\-line\-discard (C\-u)
|
709 |
|
|
Kill backward from point to the beginning of the line.
|
710 |
|
|
The killed text is saved on the kill-ring.
|
711 |
|
|
.\" There is no real difference between this and backward-kill-line
|
712 |
|
|
.TP
|
713 |
|
|
.B kill\-whole\-line
|
714 |
|
|
Kill all characters on the current line, no matter where the
|
715 |
|
|
cursor is.
|
716 |
|
|
.TP
|
717 |
|
|
.B kill\-word (M\-d)
|
718 |
|
|
Kill from the cursor to the end of the current word, or if between
|
719 |
|
|
words, to the end of the next word. Word boundaries are the same as
|
720 |
|
|
those used by \fBforward\-word\fP.
|
721 |
|
|
.TP
|
722 |
|
|
.B backward\-kill\-word (M\-Rubout)
|
723 |
|
|
Kill the word behind the cursor. Word boundaries are the same as
|
724 |
|
|
those used by \fBbackward\-word\fP.
|
725 |
|
|
.TP
|
726 |
|
|
.B unix\-word\-rubout (C\-w)
|
727 |
|
|
Kill the word behind the cursor, using white space as a word boundary.
|
728 |
|
|
The word boundaries are different from
|
729 |
|
|
.BR backward\-kill\-word .
|
730 |
|
|
.TP
|
731 |
|
|
.B delete\-horizontal\-space (M\-\e)
|
732 |
|
|
Delete all spaces and tabs around point.
|
733 |
|
|
.TP
|
734 |
|
|
.B kill\-region
|
735 |
|
|
Kill the text between the point and \fImark\fP (saved cursor position).
|
736 |
|
|
This text is referred to as the \fIregion\fP.
|
737 |
|
|
.TP
|
738 |
|
|
.B copy\-region\-as\-kill
|
739 |
|
|
Copy the text in the region to the kill buffer.
|
740 |
|
|
.TP
|
741 |
|
|
.B copy\-backward\-word
|
742 |
|
|
Copy the word before point to the kill buffer.
|
743 |
|
|
The word boundaries are the same as \fBbackward\-word\fP.
|
744 |
|
|
.TP
|
745 |
|
|
.B copy\-forward\-word
|
746 |
|
|
Copy the word following point to the kill buffer.
|
747 |
|
|
The word boundaries are the same as \fBforward\-word\fP.
|
748 |
|
|
.TP
|
749 |
|
|
.B yank (C\-y)
|
750 |
|
|
Yank the top of the kill ring into the buffer at the cursor.
|
751 |
|
|
.TP
|
752 |
|
|
.B yank\-pop (M\-y)
|
753 |
|
|
Rotate the kill ring, and yank the new top. Only works following
|
754 |
|
|
.B yank
|
755 |
|
|
or
|
756 |
|
|
.BR yank\-pop .
|
757 |
|
|
.PD
|
758 |
|
|
.SS Numeric Arguments
|
759 |
|
|
.PP
|
760 |
|
|
.PD 0
|
761 |
|
|
.TP
|
762 |
|
|
.B digit\-argument (M\-0, M\-1, ..., M\-\-)
|
763 |
|
|
Add this digit to the argument already accumulating, or start a new
|
764 |
|
|
argument. M\-\- starts a negative argument.
|
765 |
|
|
.TP
|
766 |
|
|
.B universal\-argument
|
767 |
|
|
This is another way to specify an argument.
|
768 |
|
|
If this command is followed by one or more digits, optionally with a
|
769 |
|
|
leading minus sign, those digits define the argument.
|
770 |
|
|
If the command is followed by digits, executing
|
771 |
|
|
.B universal\-argument
|
772 |
|
|
again ends the numeric argument, but is otherwise ignored.
|
773 |
|
|
As a special case, if this command is immediately followed by a
|
774 |
|
|
character that is neither a digit or minus sign, the argument count
|
775 |
|
|
for the next command is multiplied by four.
|
776 |
|
|
The argument count is initially one, so executing this function the
|
777 |
|
|
first time makes the argument count four, a second time makes the
|
778 |
|
|
argument count sixteen, and so on.
|
779 |
|
|
.PD
|
780 |
|
|
.SS Completing
|
781 |
|
|
.PP
|
782 |
|
|
.PD 0
|
783 |
|
|
.TP
|
784 |
|
|
.B complete (TAB)
|
785 |
|
|
Attempt to perform completion on the text before point.
|
786 |
|
|
The actual completion performed is application-specific.
|
787 |
|
|
.BR Bash ,
|
788 |
|
|
for instance, attempts completion treating the text as a variable
|
789 |
|
|
(if the text begins with \fB$\fP), username (if the text begins with
|
790 |
|
|
\fB~\fP), hostname (if the text begins with \fB@\fP), or
|
791 |
|
|
command (including aliases and functions) in turn. If none
|
792 |
|
|
of these produces a match, filename completion is attempted.
|
793 |
|
|
.BR Gdb ,
|
794 |
|
|
on the other hand,
|
795 |
|
|
allows completion of program functions and variables, and
|
796 |
|
|
only attempts filename completion under certain circumstances.
|
797 |
|
|
.TP
|
798 |
|
|
.B possible\-completions (M\-?)
|
799 |
|
|
List the possible completions of the text before point.
|
800 |
|
|
.TP
|
801 |
|
|
.B insert\-completions (M\-*)
|
802 |
|
|
Insert all completions of the text before point
|
803 |
|
|
that would have been generated by
|
804 |
|
|
\fBpossible\-completions\fP.
|
805 |
|
|
.TP
|
806 |
|
|
.B menu\-complete
|
807 |
|
|
Similar to \fBcomplete\fP, but replaces the word to be completed
|
808 |
|
|
with a single match from the list of possible completions.
|
809 |
|
|
Repeated execution of \fBmenu\-complete\fP steps through the list
|
810 |
|
|
of possible completions, inserting each match in turn.
|
811 |
|
|
At the end of the list of completions, the bell is rung and the
|
812 |
|
|
original text is restored.
|
813 |
|
|
An argument of \fIn\fP moves \fIn\fP positions forward in the list
|
814 |
|
|
of matches; a negative argument may be used to move backward
|
815 |
|
|
through the list.
|
816 |
|
|
This command is intended to be bound to \fBTAB\fP, but is unbound
|
817 |
|
|
by default.
|
818 |
|
|
.TP
|
819 |
|
|
.B delete\-char\-or\-list
|
820 |
|
|
Deletes the character under the cursor if not at the beginning or
|
821 |
|
|
end of the line (like \fBdelete-char\fP).
|
822 |
|
|
If at the end of the line, behaves identically to
|
823 |
|
|
\fBpossible-completions\fP.
|
824 |
|
|
This command is unbound by default.
|
825 |
|
|
.PD
|
826 |
|
|
.SS Keyboard Macros
|
827 |
|
|
.PP
|
828 |
|
|
.PD 0
|
829 |
|
|
.TP
|
830 |
|
|
.B start\-kbd\-macro (C\-x (\^)
|
831 |
|
|
Begin saving the characters typed into the current keyboard macro.
|
832 |
|
|
.TP
|
833 |
|
|
.B end\-kbd\-macro (C\-x )\^)
|
834 |
|
|
Stop saving the characters typed into the current keyboard macro
|
835 |
|
|
and store the definition.
|
836 |
|
|
.TP
|
837 |
|
|
.B call\-last\-kbd\-macro (C\-x e)
|
838 |
|
|
Re-execute the last keyboard macro defined, by making the characters
|
839 |
|
|
in the macro appear as if typed at the keyboard.
|
840 |
|
|
.PD
|
841 |
|
|
.SS Miscellaneous
|
842 |
|
|
.PP
|
843 |
|
|
.PD 0
|
844 |
|
|
.TP
|
845 |
|
|
.B re\-read\-init\-file (C\-x C\-r)
|
846 |
|
|
Read in the contents of the \fIinputrc\fP file, and incorporate
|
847 |
|
|
any bindings or variable assignments found there.
|
848 |
|
|
.TP
|
849 |
|
|
.B abort (C\-g)
|
850 |
|
|
Abort the current editing command and
|
851 |
|
|
ring the terminal's bell (subject to the setting of
|
852 |
|
|
.BR bell\-style ).
|
853 |
|
|
.TP
|
854 |
|
|
.B do\-uppercase\-version (M\-a, M\-b, M\-\fIx\fP, ...)
|
855 |
|
|
If the metafied character \fIx\fP is lowercase, run the command
|
856 |
|
|
that is bound to the corresponding uppercase character.
|
857 |
|
|
.TP
|
858 |
|
|
.B prefix\-meta (ESC)
|
859 |
|
|
Metafy the next character typed.
|
860 |
|
|
.SM
|
861 |
|
|
.B ESC
|
862 |
|
|
.B f
|
863 |
|
|
is equivalent to
|
864 |
|
|
.BR Meta\-f .
|
865 |
|
|
.TP
|
866 |
|
|
.B undo (C\-_, C\-x C\-u)
|
867 |
|
|
Incremental undo, separately remembered for each line.
|
868 |
|
|
.TP
|
869 |
|
|
.B revert\-line (M\-r)
|
870 |
|
|
Undo all changes made to this line. This is like executing the
|
871 |
|
|
.B undo
|
872 |
|
|
command enough times to return the line to its initial state.
|
873 |
|
|
.TP
|
874 |
|
|
.B tilde\-expand (M\-&)
|
875 |
|
|
Perform tilde expansion on the current word.
|
876 |
|
|
.TP
|
877 |
|
|
.B set\-mark (C\-@, M-)
|
878 |
|
|
Set the mark to the current point. If a
|
879 |
|
|
numeric argument is supplied, the mark is set to that position.
|
880 |
|
|
.TP
|
881 |
|
|
.B exchange\-point\-and\-mark (C\-x C\-x)
|
882 |
|
|
Swap the point with the mark. The current cursor position is set to
|
883 |
|
|
the saved position, and the old cursor position is saved as the mark.
|
884 |
|
|
.TP
|
885 |
|
|
.B character\-search (C\-])
|
886 |
|
|
A character is read and point is moved to the next occurrence of that
|
887 |
|
|
character. A negative count searches for previous occurrences.
|
888 |
|
|
.TP
|
889 |
|
|
.B character\-search\-backward (M\-C\-])
|
890 |
|
|
A character is read and point is moved to the previous occurrence of that
|
891 |
|
|
character. A negative count searches for subsequent occurrences.
|
892 |
|
|
.TP
|
893 |
|
|
.B insert\-comment (M\-#)
|
894 |
|
|
The value of the readline
|
895 |
|
|
.B comment\-begin
|
896 |
|
|
variable is inserted at the beginning of the current line, and the line
|
897 |
|
|
is accepted as if a newline had been typed. This makes the current line
|
898 |
|
|
a shell comment.
|
899 |
|
|
.TP
|
900 |
|
|
.B dump\-functions
|
901 |
|
|
Print all of the functions and their key bindings to the
|
902 |
|
|
readline output stream. If a numeric argument is supplied,
|
903 |
|
|
the output is formatted in such a way that it can be made part
|
904 |
|
|
of an \fIinputrc\fP file.
|
905 |
|
|
.TP
|
906 |
|
|
.B dump\-variables
|
907 |
|
|
Print all of the settable variables and their values to the
|
908 |
|
|
readline output stream. If a numeric argument is supplied,
|
909 |
|
|
the output is formatted in such a way that it can be made part
|
910 |
|
|
of an \fIinputrc\fP file.
|
911 |
|
|
.TP
|
912 |
|
|
.B dump\-macros
|
913 |
|
|
Print all of the readline key sequences bound to macros and the
|
914 |
|
|
strings they ouput. If a numeric argument is supplied,
|
915 |
|
|
the output is formatted in such a way that it can be made part
|
916 |
|
|
of an \fIinputrc\fP file.
|
917 |
|
|
.TP
|
918 |
|
|
.B emacs\-editing\-mode (C\-e)
|
919 |
|
|
When in
|
920 |
|
|
.B vi
|
921 |
|
|
editing mode, this causes a switch to
|
922 |
|
|
.B emacs
|
923 |
|
|
editing mode.
|
924 |
|
|
.TP
|
925 |
|
|
.B vi\-editing\-mode (M\-C\-j)
|
926 |
|
|
When in
|
927 |
|
|
.B emacs
|
928 |
|
|
editing mode, this causes a switch to
|
929 |
|
|
.B vi
|
930 |
|
|
editing mode.
|
931 |
|
|
.PD
|
932 |
|
|
.SH DEFAULT KEY BINDINGS
|
933 |
|
|
.LP
|
934 |
|
|
The following is a list of the default emacs and vi bindings.
|
935 |
|
|
Characters with the 8th bit set are written as M\-, and
|
936 |
|
|
are referred to as
|
937 |
|
|
.I metafied
|
938 |
|
|
characters.
|
939 |
|
|
The printable ASCII characters not mentioned in the list of emacs
|
940 |
|
|
standard bindings are bound to the
|
941 |
|
|
.I self\-insert
|
942 |
|
|
function, which just inserts the given character into the input line.
|
943 |
|
|
In vi insertion mode, all characters not specifically mentioned are
|
944 |
|
|
bound to
|
945 |
|
|
.IR self\-insert .
|
946 |
|
|
Characters assigned to signal generation by
|
947 |
|
|
.IR stty (1)
|
948 |
|
|
or the terminal driver, such as C-Z or C-C,
|
949 |
|
|
retain that function.
|
950 |
|
|
Upper and lower case
|
951 |
|
|
.I metafied
|
952 |
|
|
characters are bound to the same function in the emacs mode
|
953 |
|
|
meta keymap.
|
954 |
|
|
The remaining characters are unbound, which causes readline
|
955 |
|
|
to ring the bell (subject to the setting of the
|
956 |
|
|
.B bell\-style
|
957 |
|
|
variable).
|
958 |
|
|
.SS Emacs Mode
|
959 |
|
|
.RS +.6i
|
960 |
|
|
.nf
|
961 |
|
|
.ta 2.5i
|
962 |
|
|
.sp
|
963 |
|
|
Emacs Standard bindings
|
964 |
|
|
.sp
|
965 |
|
|
"C-@" set-mark
|
966 |
|
|
"C-A" beginning-of-line
|
967 |
|
|
"C-B" backward-char
|
968 |
|
|
"C-D" delete-char
|
969 |
|
|
"C-E" end-of-line
|
970 |
|
|
"C-F" forward-char
|
971 |
|
|
"C-G" abort
|
972 |
|
|
"C-H" backward-delete-char
|
973 |
|
|
"C-I" complete
|
974 |
|
|
"C-J" accept-line
|
975 |
|
|
"C-K" kill-line
|
976 |
|
|
"C-L" clear-screen
|
977 |
|
|
"C-M" accept-line
|
978 |
|
|
"C-N" next-history
|
979 |
|
|
"C-P" previous-history
|
980 |
|
|
"C-Q" quoted-insert
|
981 |
|
|
"C-R" reverse-search-history
|
982 |
|
|
"C-S" forward-search-history
|
983 |
|
|
"C-T" transpose-chars
|
984 |
|
|
"C-U" unix-line-discard
|
985 |
|
|
"C-V" quoted-insert
|
986 |
|
|
"C-W" unix-word-rubout
|
987 |
|
|
"C-Y" yank
|
988 |
|
|
"C-]" character-search
|
989 |
|
|
"C-_" undo
|
990 |
|
|
"\^ " to "/" self-insert
|
991 |
|
|
"0" to "9" self-insert
|
992 |
|
|
":" to "~" self-insert
|
993 |
|
|
"C-?" backward-delete-char
|
994 |
|
|
.PP
|
995 |
|
|
Emacs Meta bindings
|
996 |
|
|
.sp
|
997 |
|
|
"M-C-G" abort
|
998 |
|
|
"M-C-H" backward-kill-word
|
999 |
|
|
"M-C-I" tab-insert
|
1000 |
|
|
"M-C-J" vi-editing-mode
|
1001 |
|
|
"M-C-M" vi-editing-mode
|
1002 |
|
|
"M-C-R" revert-line
|
1003 |
|
|
"M-C-Y" yank-nth-arg
|
1004 |
|
|
"M-C-[" complete
|
1005 |
|
|
"M-C-]" character-search-backward
|
1006 |
|
|
"M-space" set-mark
|
1007 |
|
|
"M-#" insert-comment
|
1008 |
|
|
"M-&" tilde-expand
|
1009 |
|
|
"M-*" insert-completions
|
1010 |
|
|
"M--" digit-argument
|
1011 |
|
|
"M-." yank-last-arg
|
1012 |
|
|
"M-0" digit-argument
|
1013 |
|
|
"M-1" digit-argument
|
1014 |
|
|
"M-2" digit-argument
|
1015 |
|
|
"M-3" digit-argument
|
1016 |
|
|
"M-4" digit-argument
|
1017 |
|
|
"M-5" digit-argument
|
1018 |
|
|
"M-6" digit-argument
|
1019 |
|
|
"M-7" digit-argument
|
1020 |
|
|
"M-8" digit-argument
|
1021 |
|
|
"M-9" digit-argument
|
1022 |
|
|
"M-<" beginning-of-history
|
1023 |
|
|
"M-=" possible-completions
|
1024 |
|
|
"M->" end-of-history
|
1025 |
|
|
"M-?" possible-completions
|
1026 |
|
|
"M-B" backward-word
|
1027 |
|
|
"M-C" capitalize-word
|
1028 |
|
|
"M-D" kill-word
|
1029 |
|
|
"M-F" forward-word
|
1030 |
|
|
"M-L" downcase-word
|
1031 |
|
|
"M-N" non-incremental-forward-search-history
|
1032 |
|
|
"M-P" non-incremental-reverse-search-history
|
1033 |
|
|
"M-R" revert-line
|
1034 |
|
|
"M-T" transpose-words
|
1035 |
|
|
"M-U" upcase-word
|
1036 |
|
|
"M-Y" yank-pop
|
1037 |
|
|
"M-\e" delete-horizontal-space
|
1038 |
|
|
"M-~" tilde-expand
|
1039 |
|
|
"M-C-?" backward-delete-word
|
1040 |
|
|
"M-_" yank-last-arg
|
1041 |
|
|
.PP
|
1042 |
|
|
Emacs Control-X bindings
|
1043 |
|
|
.sp
|
1044 |
|
|
"C-XC-G" abort
|
1045 |
|
|
"C-XC-R" re-read-init-file
|
1046 |
|
|
"C-XC-U" undo
|
1047 |
|
|
"C-XC-X" exchange-point-and-mark
|
1048 |
|
|
"C-X(" start-kbd-macro
|
1049 |
|
|
"C-X)" end-kbd-macro
|
1050 |
|
|
"C-XE" call-last-kbd-macro
|
1051 |
|
|
"C-XC-?" backward-kill-line
|
1052 |
|
|
.sp
|
1053 |
|
|
.RE
|
1054 |
|
|
.SS VI Mode bindings
|
1055 |
|
|
.RS +.6i
|
1056 |
|
|
.nf
|
1057 |
|
|
.ta 2.5i
|
1058 |
|
|
.sp
|
1059 |
|
|
.PP
|
1060 |
|
|
VI Insert Mode functions
|
1061 |
|
|
.sp
|
1062 |
|
|
"C-D" vi-eof-maybe
|
1063 |
|
|
"C-H" backward-delete-char
|
1064 |
|
|
"C-I" complete
|
1065 |
|
|
"C-J" accept-line
|
1066 |
|
|
"C-M" accept-line
|
1067 |
|
|
"C-R" reverse-search-history
|
1068 |
|
|
"C-S" forward-search-history
|
1069 |
|
|
"C-T" transpose-chars
|
1070 |
|
|
"C-U" unix-line-discard
|
1071 |
|
|
"C-V" quoted-insert
|
1072 |
|
|
"C-W" unix-word-rubout
|
1073 |
|
|
"C-Y" yank
|
1074 |
|
|
"C-[" vi-movement-mode
|
1075 |
|
|
"C-_" undo
|
1076 |
|
|
"\^ " to "~" self-insert
|
1077 |
|
|
"C-?" backward-delete-char
|
1078 |
|
|
.PP
|
1079 |
|
|
VI Command Mode functions
|
1080 |
|
|
.sp
|
1081 |
|
|
"C-D" vi-eof-maybe
|
1082 |
|
|
"C-E" emacs-editing-mode
|
1083 |
|
|
"C-G" abort
|
1084 |
|
|
"C-H" backward-char
|
1085 |
|
|
"C-J" accept-line
|
1086 |
|
|
"C-K" kill-line
|
1087 |
|
|
"C-L" clear-screen
|
1088 |
|
|
"C-M" accept-line
|
1089 |
|
|
"C-N" next-history
|
1090 |
|
|
"C-P" previous-history
|
1091 |
|
|
"C-Q" quoted-insert
|
1092 |
|
|
"C-R" reverse-search-history
|
1093 |
|
|
"C-S" forward-search-history
|
1094 |
|
|
"C-T" transpose-chars
|
1095 |
|
|
"C-U" unix-line-discard
|
1096 |
|
|
"C-V" quoted-insert
|
1097 |
|
|
"C-W" unix-word-rubout
|
1098 |
|
|
"C-Y" yank
|
1099 |
|
|
"\^ " forward-char
|
1100 |
|
|
"#" insert-comment
|
1101 |
|
|
"$" end-of-line
|
1102 |
|
|
"%" vi-match
|
1103 |
|
|
"&" vi-tilde-expand
|
1104 |
|
|
"*" vi-complete
|
1105 |
|
|
"+" next-history
|
1106 |
|
|
"," vi-char-search
|
1107 |
|
|
"-" previous-history
|
1108 |
|
|
"." vi-redo
|
1109 |
|
|
"/" vi-search
|
1110 |
|
|
"0" beginning-of-line
|
1111 |
|
|
"1" to "9" vi-arg-digit
|
1112 |
|
|
";" vi-char-search
|
1113 |
|
|
"=" vi-complete
|
1114 |
|
|
"?" vi-search
|
1115 |
|
|
"A" vi-append-eol
|
1116 |
|
|
"B" vi-prev-word
|
1117 |
|
|
"C" vi-change-to
|
1118 |
|
|
"D" vi-delete-to
|
1119 |
|
|
"E" vi-end-word
|
1120 |
|
|
"F" vi-char-search
|
1121 |
|
|
"G" vi-fetch-history
|
1122 |
|
|
"I" vi-insert-beg
|
1123 |
|
|
"N" vi-search-again
|
1124 |
|
|
"P" vi-put
|
1125 |
|
|
"R" vi-replace
|
1126 |
|
|
"S" vi-subst
|
1127 |
|
|
"T" vi-char-search
|
1128 |
|
|
"U" revert-line
|
1129 |
|
|
"W" vi-next-word
|
1130 |
|
|
"X" backward-delete-char
|
1131 |
|
|
"Y" vi-yank-to
|
1132 |
|
|
"\e" vi-complete
|
1133 |
|
|
"^" vi-first-print
|
1134 |
|
|
"_" vi-yank-arg
|
1135 |
|
|
"`" vi-goto-mark
|
1136 |
|
|
"a" vi-append-mode
|
1137 |
|
|
"b" vi-prev-word
|
1138 |
|
|
"c" vi-change-to
|
1139 |
|
|
"d" vi-delete-to
|
1140 |
|
|
"e" vi-end-word
|
1141 |
|
|
"f" vi-char-search
|
1142 |
|
|
"h" backward-char
|
1143 |
|
|
"i" vi-insertion-mode
|
1144 |
|
|
"j" next-history
|
1145 |
|
|
"k" prev-history
|
1146 |
|
|
"l" forward-char
|
1147 |
|
|
"m" vi-set-mark
|
1148 |
|
|
"n" vi-search-again
|
1149 |
|
|
"p" vi-put
|
1150 |
|
|
"r" vi-change-char
|
1151 |
|
|
"s" vi-subst
|
1152 |
|
|
"t" vi-char-search
|
1153 |
|
|
"u" undo
|
1154 |
|
|
"w" vi-next-word
|
1155 |
|
|
"x" vi-delete
|
1156 |
|
|
"y" vi-yank-to
|
1157 |
|
|
"|" vi-column
|
1158 |
|
|
"~" vi-change-case
|
1159 |
|
|
.RE
|
1160 |
|
|
.SH "SEE ALSO"
|
1161 |
|
|
.PD 0
|
1162 |
|
|
.TP
|
1163 |
|
|
\fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey
|
1164 |
|
|
.TP
|
1165 |
|
|
\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey
|
1166 |
|
|
.TP
|
1167 |
|
|
\fIbash\fP(1)
|
1168 |
|
|
.PD
|
1169 |
|
|
.SH FILES
|
1170 |
|
|
.PD 0
|
1171 |
|
|
.TP
|
1172 |
|
|
.FN ~/.inputrc
|
1173 |
|
|
Individual \fBreadline\fP initialization file
|
1174 |
|
|
.PD
|
1175 |
|
|
.SH AUTHORS
|
1176 |
|
|
Brian Fox, Free Software Foundation
|
1177 |
|
|
.br
|
1178 |
|
|
bfox@gnu.org
|
1179 |
|
|
.PP
|
1180 |
|
|
Chet Ramey, Case Western Reserve University
|
1181 |
|
|
.br
|
1182 |
|
|
chet@ins.CWRU.Edu
|
1183 |
|
|
.SH BUG REPORTS
|
1184 |
|
|
If you find a bug in
|
1185 |
|
|
.B readline,
|
1186 |
|
|
you should report it. But first, you should
|
1187 |
|
|
make sure that it really is a bug, and that it appears in the latest
|
1188 |
|
|
version of the
|
1189 |
|
|
.B readline
|
1190 |
|
|
library that you have.
|
1191 |
|
|
.PP
|
1192 |
|
|
Once you have determined that a bug actually exists, mail a
|
1193 |
|
|
bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
|
1194 |
|
|
If you have a fix, you are welcome to mail that
|
1195 |
|
|
as well! Suggestions and `philosophical' bug reports may be mailed
|
1196 |
|
|
to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
|
1197 |
|
|
newsgroup
|
1198 |
|
|
.BR gnu.bash.bug .
|
1199 |
|
|
.PP
|
1200 |
|
|
Comments and bug reports concerning
|
1201 |
|
|
this manual page should be directed to
|
1202 |
|
|
.IR chet@ins.CWRU.Edu .
|
1203 |
|
|
.SH BUGS
|
1204 |
|
|
.PP
|
1205 |
|
|
It's too big and too slow.
|