~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to system/unix/manl/readline.l

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

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