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