3d161689d2d4611471a49eb35a7a64fe78042bc6
[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: Wed Feb  5 14:13:22 EST 1997
10 .\"
11 .TH READLINE 3 "1997 Feb 5" 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 This is another way to specify an argument.
686 If this command is followed by one or more digits, optionally with a
687 leading minus sign, those digits define the argument.
688 If the command is followed by digits, executing
689 .B universal\-argument
690 again ends the numeric argument, but is otherwise ignored.
691 As a special case, if this command is immediately followed by a
692 character that is neither a digit or minus sign, the argument count
693 for the next command is multiplied by four.
694 The argument count is initially one, so executing this function the
695 first time makes the argument count four, a second time makes the
696 argument count sixteen, and so on.
697 .PD
698 .SS Completing
699 .PP
700 .PD 0
701 .TP
702 .B complete (TAB)
703 Attempt to perform completion on the text before point.
704 The actual completion performed is application-specific.
705 .BR Bash ,
706 for instance, attempts completion treating the text as a variable
707 (if the text begins with \fB$\fP), username (if the text begins with
708 \fB~\fP), hostname (if the text begins with \fB@\fP), or
709 command (including aliases and functions) in turn.  If none
710 of these produces a match, filename completion is attempted.
711 .BR Gdb ,
712 on the other hand,
713 allows completion of program functions and variables, and
714 only attempts filename completion under certain circumstances.
715 .TP
716 .B possible\-completions (M\-?)
717 List the possible completions of the text before point.
718 .TP
719 .B insert\-completions (M\-*)
720 Insert all completions of the text before point
721 that would have been generated by
722 \fBpossible\-completions\fP.
723 .PD
724 .SS Keyboard Macros
725 .PP
726 .PD 0
727 .TP
728 .B start\-kbd\-macro (C\-x (\^)
729 Begin saving the characters typed into the current keyboard macro.
730 .TP
731 .B end\-kbd\-macro (C\-x )\^)
732 Stop saving the characters typed into the current keyboard macro
733 and store the definition.
734 .TP
735 .B call\-last\-kbd\-macro (C\-x e)
736 Re-execute the last keyboard macro defined, by making the characters
737 in the macro appear as if typed at the keyboard.
738 .PD
739 .SS Miscellaneous
740 .PP
741 .PD 0
742 .TP
743 .B re\-read\-init\-file (C\-x C\-r)
744 Read in the contents of the \fIinputrc\fP file, and incorporate
745 any bindings or variable assignments found there.
746 .TP
747 .B abort (C\-g)
748 Abort the current editing command and
749 ring the terminal's bell (subject to the setting of
750 .BR bell\-style ).
751 .TP
752 .B do\-uppercase\-version (M\-a, M\-b, M\-\fIx\fP, ...)
753 If the metafied character \fIx\fP is lowercase, run the command
754 that is bound to the corresponding uppercase character.
755 .TP
756 .B prefix\-meta (ESC)
757 Metafy the next character typed.
758 .SM
759 .B ESC
760 .B f
761 is equivalent to
762 .BR Meta\-f .
763 .TP
764 .B undo (C\-_, C\-x C\-u)
765 Incremental undo, separately remembered for each line.
766 .TP
767 .B revert\-line (M\-r)
768 Undo all changes made to this line.  This is like typing the
769 .B undo
770 command enough times to return the line to its initial state.
771 .TP
772 .B tilde\-expand (M\-~)
773 Perform tilde expansion on the current word.
774 .TP
775 .B set\-mark (C\-@, M-<space>)
776 Set the mark to the current point.  If a
777 numeric argument is supplied, the mark is set to that position.
778 .TP
779 .B exchange\-point\-and\-mark (C\-x C\-x)
780 Swap the point with the mark.  The current cursor position is set to
781 the saved position, and the old cursor position is saved as the mark.
782 .TP
783 .B character\-search (C\-])
784 A character is read and point is moved to the next occurrence of that
785 character.  A negative count searches for previous occurrences.
786 .TP
787 .B character\-search\-backward (M\-C\-])
788 A character is read and point is moved to the previous occurrence of that
789 character.  A negative count searches for subsequent occurrences.
790 .TP
791 .B insert\-comment (M\-#)
792 The value of the readline
793 .B comment\-begin
794 variable is inserted at the beginning of the current line, and the line
795 is accepted as if a newline had been typed.  This makes the current line
796 a shell comment.
797 .TP
798 .B glob\-expand\-word (C\-x *)
799 The word before point is treated as a pattern for pathname expansion,
800 and the list of matching file names is inserted, replacing the word.
801 .TP
802 .B glob\-list\-expansions (C\-x g)
803 The list of expansions that would have been generated by
804 .B glob\-expand\-word
805 is inserted into the line, replacing the word before point.
806 .TP
807 .B dump\-functions
808 Print all of the functions and their key bindings to the
809 readline output stream.  If a numeric argument is supplied,
810 the output is formatted in such a way that it can be made part
811 of an \fIinputrc\fP file.
812 .TP
813 .B dump\-variables
814 Print all of the settable variables and their values to the
815 readline output stream.  If a numeric argument is supplied,
816 the output is formatted in such a way that it can be made part
817 of an \fIinputrc\fP file.
818 .TP
819 .B dump\-macros
820 Print all of the readline key sequences bound to macros and the
821 strings they ouput.  If a numeric argument is supplied,
822 the output is formatted in such a way that it can be made part
823 of an \fIinputrc\fP file.
824 .TP
825 .B emacs\-editing\-mode (C\-e)
826 When in
827 .B vi
828 editing mode, this causes a switch to
829 .B emacs
830 editing mode.
831 .TP
832 .B vi\-editing\-mode (M\-C\-j)
833 When in
834 .B emacs
835 editing mode, this causes a switch to
836 .B vi
837 editing mode.
838 .PD
839 .SH DEFAULT KEY BINDINGS
840 .LP
841 The following is a list of the default emacs and vi bindings.
842 Characters with the 8th bit set are written as M\-<character>, and
843 are referred to as
844 .I metafied
845 characters.
846 The printable ASCII characters not mentioned in the list of emacs
847 standard bindings are bound to the
848 .I self\-insert
849 function, which just inserts the given character into the input line.
850 In vi insertion mode, all characters not specifically mentioned are
851 bound to
852 .IR self\-insert .
853 Characters assigned to signal generation by
854 .IR stty (1)
855 or the terminal driver, such as C-Z or C-C,
856 retain that function.
857 Upper and lower case
858 .I metafied
859 characters are bound to the same function in the emacs mode
860 meta keymap.
861 The remaining characters are unbound, which causes readline
862 to ring the bell (subject to the setting of the
863 .B bell\-style
864 variable).
865 .SS Emacs Mode
866 .RS +.6i
867 .nf
868 .ta 2.5i
869 .sp
870 Emacs Standard bindings
871 .sp
872 "C-@"  set-mark
873 "C-A"  beginning-of-line
874 "C-B"  backward-char
875 "C-D"  delete-char
876 "C-E"  end-of-line
877 "C-F"  forward-char
878 "C-G"  abort
879 "C-H"  backward-delete-char
880 "C-I"  complete
881 "C-J"  accept-line
882 "C-K"  kill-line
883 "C-L"  clear-screen
884 "C-M"  accept-line
885 "C-N"  next-history
886 "C-P"  previous-history
887 "C-Q"  quoted-insert
888 "C-R"  reverse-search-history
889 "C-S"  forward-search-history
890 "C-T"  transpose-chars
891 "C-U"  unix-line-discard
892 "C-V"  quoted-insert
893 "C-W"  unix-word-rubout
894 "C-Y"  yank
895 "C-]"  character-search
896 "C-_"  undo
897 "\^ " to "/"  self-insert
898 "0"  to "9"  self-insert
899 ":"  to "~"  self-insert
900 "C-?"  backward-delete-char
901 .PP
902 Emacs Meta bindings
903 .sp
904 "M-C-G"  abort
905 "M-C-H"  backward-kill-word
906 "M-C-I"  tab-insert
907 "M-C-J"  vi-editing-mode
908 "M-C-M"  vi-editing-mode
909 "M-C-R"  revert-line
910 "M-C-Y"  yank-nth-arg
911 "M-C-["  complete
912 "M-C-]"  character-search-backward
913 "M-space"  set-mark
914 "M-#"  insert-comment
915 "M-&"  tilde-expand
916 "M-*"  insert-completions
917 "M--"  digit-argument
918 "M-."  yank-last-arg
919 "M-0"  digit-argument
920 "M-1"  digit-argument
921 "M-2"  digit-argument
922 "M-3"  digit-argument
923 "M-4"  digit-argument
924 "M-5"  digit-argument
925 "M-6"  digit-argument
926 "M-7"  digit-argument
927 "M-8"  digit-argument
928 "M-9"  digit-argument
929 "M-<"  beginning-of-history
930 "M-="  possible-completions
931 "M->"  end-of-history
932 "M-?"  possible-completions
933 "M-B"  backward-word
934 "M-C"  capitalize-word
935 "M-D"  kill-word
936 "M-F"  forward-word
937 "M-L"  downcase-word
938 "M-N"  non-incremental-forward-search-history
939 "M-P"  non-incremental-reverse-search-history
940 "M-R"  revert-line
941 "M-T"  transpose-words
942 "M-U"  upcase-word
943 "M-Y"  yank-pop
944 "M-\e"  delete-horizontal-space
945 "M-~"  tilde-expand
946 "M-C-?"  backward-delete-word
947 "M-_"  yank-last-arg
948 .PP
949 Emacs Control-X bindings
950 .sp
951 "C-XC-G"  abort
952 "C-XC-R"  re-read-init-file
953 "C-XC-U"  undo
954 "C-XC-X"  exchange-point-and-mark
955 "C-X("  start-kbd-macro
956 "C-X)"  end-kbd-macro
957 "C-XE"  call-last-kbd-macro
958 "C-XC-?"  backward-kill-line
959 .sp
960 .RE
961 .SS VI Mode bindings
962 .RS +.6i
963 .nf
964 .ta 2.5i
965 .sp
966 .PP
967 VI Insert Mode functions
968 .sp
969 "C-D"  vi-eof-maybe
970 "C-H"  backward-delete-char
971 "C-I"  complete
972 "C-J"  accept-line
973 "C-M"  accept-line
974 "C-R"  reverse-search-history
975 "C-S"  forward-search-history
976 "C-T"  transpose-chars
977 "C-U"  unix-line-discard
978 "C-V"  quoted-insert
979 "C-W"  unix-word-rubout
980 "C-Y"  yank
981 "C-["  vi-movement-mode
982 "C-_"  undo
983 "\^ " to "~"  self-insert
984 "C-?"  backward-delete-char
985 .PP
986 VI Command Mode functions
987 .sp
988 "C-D"  vi-eof-maybe
989 "C-E"  emacs-editing-mode
990 "C-G"  abort
991 "C-H"  backward-char
992 "C-J"  accept-line
993 "C-K"  kill-line
994 "C-L"  clear-screen
995 "C-M"  accept-line
996 "C-N"  next-history
997 "C-P"  previous-history
998 "C-Q"  quoted-insert
999 "C-R"  reverse-search-history
1000 "C-S"  forward-search-history
1001 "C-T"  transpose-chars
1002 "C-U"  unix-line-discard
1003 "C-V"  quoted-insert
1004 "C-W"  unix-word-rubout
1005 "C-Y"  yank
1006 "\^ "  forward-char
1007 "#"  insert-comment
1008 "$"  end-of-line
1009 "%"  vi-match
1010 "&"  vi-tilde-expand
1011 "*"  vi-complete
1012 "+"  next-history
1013 ","  vi-char-search
1014 "-"  previous-history
1015 "."  vi-redo
1016 "/"  vi-search
1017 "0"  beginning-of-line
1018 "1" to "9"  vi-arg-digit
1019 ";"  vi-char-search
1020 "="  vi-complete
1021 "?"  vi-search
1022 "A"  vi-append-eol
1023 "B"  vi-prev-word
1024 "C"  vi-change-to
1025 "D"  vi-delete-to
1026 "E"  vi-end-word
1027 "F"  vi-char-search
1028 "G"  vi-fetch-history
1029 "I"  vi-insert-beg
1030 "N"  vi-search-again
1031 "P"  vi-put
1032 "R"  vi-replace
1033 "S"  vi-subst
1034 "T"  vi-char-search
1035 "U"  revert-line
1036 "W"  vi-next-word
1037 "X"  backward-delete-char
1038 "Y"  vi-yank-to
1039 "\e"  vi-complete
1040 "^"  vi-first-print
1041 "_"  vi-yank-arg
1042 "`"  vi-goto-mark
1043 "a"  vi-append-mode
1044 "b"  vi-prev-word
1045 "c"  vi-change-to
1046 "d"  vi-delete-to
1047 "e"  vi-end-word
1048 "f"  vi-char-search
1049 "h"  backward-char
1050 "i"  vi-insertion-mode
1051 "j"  next-history
1052 "k"  prev-history
1053 "l"  forward-char
1054 "m"  vi-set-mark
1055 "n"  vi-search-again
1056 "p"  vi-put
1057 "r"  vi-change-char
1058 "s"  vi-subst
1059 "t"  vi-char-search
1060 "u"  undo
1061 "w"  vi-next-word
1062 "x"  vi-delete
1063 "y"  vi-yank-to
1064 "|"  vi-column
1065 "~"  vi-change-case
1066 .RE
1067 .SH "SEE ALSO"
1068 .PD 0
1069 .TP
1070 \fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey
1071 .TP
1072 \fIThe Gnu History Library\fP, Brian Fox and Chet Ramey
1073 .TP
1074 \fIbash\fP(1)
1075 .PD
1076 .SH FILES
1077 .PD 0
1078 .TP
1079 .FN ~/.inputrc
1080 Individual \fBreadline\fP initialization file
1081 .PD
1082 .SH AUTHORS
1083 Brian Fox, Free Software Foundation (primary author)
1084 .br
1085 bfox@ai.MIT.Edu
1086 .PP
1087 Chet Ramey, Case Western Reserve University
1088 .br
1089 chet@ins.CWRU.Edu
1090 .SH BUG REPORTS
1091 If you find a bug in
1092 .B readline,
1093 you should report it.  But first, you should
1094 make sure that it really is a bug, and that it appears in the latest
1095 version of the
1096 .B readline
1097 library that you have.
1098 .PP
1099 Once you have determined that a bug actually exists, mail a
1100 bug report to \fIbug\-readline\fP@\fIprep.ai.MIT.Edu\fP.
1101 If you have a fix, you are welcome to mail that
1102 as well!  Suggestions and `philosophical' bug reports may be mailed
1103 to \fPbug-readline\fP@\fIprep.ai.MIT.Edu\fP or posted to the Usenet
1104 newsgroup
1105 .BR gnu.bash.bug .
1106 .PP
1107 Comments and bug reports concerning
1108 this manual page should be directed to
1109 .IR chet@ins.CWRU.Edu .
1110 .SH BUGS
1111 .PP
1112 It's too big and too slow.