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