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