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