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