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