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