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