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