Import of readline 4.1
[deliverable/binutils-gdb.git] / readline / doc / readline.0
CommitLineData
aac48392
SS
1
2
3
4READLINE(3) READLINE(3)
5
6
7N\bNA\bAM\bME\bE
8 readline - get a line from a user with editing
9
10S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
c862e87b 11 #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b>
aac48392
SS
12 #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<r\bre\bea\bad\bdl\bli\bin\bne\be.\b.h\bh>\b>
13 #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<h\bhi\bis\bst\bto\bor\bry\by.\b.h\bh>\b>
14
15 c\bch\bha\bar\br *\b*r\bre\bea\bad\bdl\bli\bin\bne\be (\b(p\bpr\bro\bom\bmp\bpt\bt)\b)
16 c\bch\bha\bar\br *\b*p\bpr\bro\bom\bmp\bpt\bt;\b;
17
18C\bCO\bOP\bPY\bYR\bRI\bIG\bGH\bHT\bT
19 Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by
20 the Free Software Foundation, Inc.
21
22D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
23 r\bre\bea\bad\bdl\bli\bin\bne\be will read a line from the terminal and return it,
24 using p\bpr\bro\bom\bmp\bpt\bt as a prompt. If p\bpr\bro\bom\bmp\bpt\bt is null, no prompt is
25 issued. The line returned is allocated with _\bm_\ba_\bl_\bl_\bo_\bc(3), so
26 the caller must free it when finished. The line returned
27 has the final newline removed, so only the text of the
28 line remains.
29
30 r\bre\bea\bad\bdl\bli\bin\bne\be offers editing capabilities while the user is
31 entering the line. By default, the line editing commands
32 are similar to those of emacs. A vi-style line editing
33 interface is also available.
34
35R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bE
36 r\bre\bea\bad\bdl\bli\bin\bne\be returns the text of the line read. A blank line
37 returns the empty string. If E\bEO\bOF\bF is encountered while
38 reading a line, and the line is empty, N\bNU\bUL\bLL\bL is returned.
39 If an E\bEO\bOF\bF is read with a non-empty line, it is treated as
40 a newline.
41
42N\bNO\bOT\bTA\bAT\bTI\bIO\bON\bN
43 An emacs-style notation is used to denote keystrokes.
44 Control keys are denoted by C-_\bk_\be_\by, e.g., C-n means Con-
45 trol-N. Similarly, _\bm_\be_\bt_\ba keys are denoted by M-_\bk_\be_\by, so M-x
46 means Meta-X. (On keyboards without a _\bm_\be_\bt_\ba key, M-_\bx means
47 ESC _\bx, i.e., press the Escape key then the _\bx key. This
48 makes ESC the _\bm_\be_\bt_\ba _\bp_\br_\be_\bf_\bi_\bx. The combination M-C-_\bx means
49 ESC-Control-_\bx, or press the Escape key then hold the Con-
50 trol key while pressing the _\bx key.)
51
52 Readline commands may be given numeric _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs, which
53 normally act as a repeat count. Sometimes, however, it is
54 the sign of the argument that is significant. Passing a
55 negative argument to a command that acts in the forward
56 direction (e.g., k\bki\bil\bll\bl-\b-l\bli\bin\bne\be) causes that command to act in
57 a backward direction. Commands whose behavior with argu-
58 ments deviates from this are noted.
59
60 When a command is described as _\bk_\bi_\bl_\bl_\bi_\bn_\bg text, the text
aac48392
SS
61
62
63
f9267e15 64GNU 1999 Jun 1 1
aac48392
SS
65
66
67
68
69
70READLINE(3) READLINE(3)
71
72
c862e87b 73 deleted is saved for possible future retrieval (_\by_\ba_\bn_\bk_\bi_\bn_\bg).
aac48392
SS
74 The killed text is saved in a _\bk_\bi_\bl_\bl _\br_\bi_\bn_\bg. Consecutive
75 kills cause the text to be accumulated into one unit,
76 which can be yanked all at once. Commands which do not
77 kill text separate the chunks of text on the kill ring.
78
79I\bIN\bNI\bIT\bTI\bIA\bAL\bLI\bIZ\bZA\bAT\bTI\bIO\bON\bN F\bFI\bIL\bLE\bE
80 Readline is customized by putting commands in an initial-
81 ization file (the _\bi_\bn_\bp_\bu_\bt_\br_\bc file). The name of this file is
82 taken from the value of the I\bIN\bNP\bPU\bUT\bTR\bRC\bC environment variable.
83 If that variable is unset, the default is _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc.
84 When a program which uses the readline library starts up,
85 the init file is read, and the key bindings and variables
86 are set. There are only a few basic constructs allowed in
87 the readline init file. Blank lines are ignored. Lines
88 beginning with a #\b# are comments. Lines beginning with a $\b$
89 indicate conditional constructs. Other lines denote key
90 bindings and variable settings. Each program using this
91 library may add its own commands and bindings.
92
93 For example, placing
94
95 M-Control-u: universal-argument
96 or
97 C-Meta-u: universal-argument
98 into the _\bi_\bn_\bp_\bu_\bt_\br_\bc would make M-C-u execute the readline
99 command _\bu_\bn_\bi_\bv_\be_\br_\bs_\ba_\bl_\b-_\ba_\br_\bg_\bu_\bm_\be_\bn_\bt.
100
101 The following symbolic character names are recognized
102 while processing key bindings: _\bR_\bU_\bB_\bO_\bU_\bT, _\bD_\bE_\bL, _\bE_\bS_\bC, _\bL_\bF_\bD, _\bN_\bE_\bW_\b-
f9267e15
EZ
103 _\bL_\bI_\bN_\bE, _\bR_\bE_\bT, _\bR_\bE_\bT_\bU_\bR_\bN, _\bS_\bP_\bC, _\bS_\bP_\bA_\bC_\bE, and _\bT_\bA_\bB.
104
105 In addition to command names, readline allows keys to be
106 bound to a string that is inserted when the key is pressed
107 (a _\bm_\ba_\bc_\br_\bo).
aac48392
SS
108
109
110 K\bKe\bey\by B\bBi\bin\bnd\bdi\bin\bng\bgs\bs
f9267e15
EZ
111 The syntax for controlling key bindings in the _\bi_\bn_\bp_\bu_\bt_\br_\bc
112 file is simple. All that is required is the name of the
aac48392 113 command or the text of a macro and a key sequence to which
f9267e15
EZ
114 it should be bound. The name may be specified in one of
115 two ways: as a symbolic key name, possibly with _\bM_\be_\bt_\ba_\b- or
116 _\bC_\bo_\bn_\bt_\br_\bo_\bl_\b- prefixes, or as a key sequence. When using the
117 form k\bke\bey\byn\bna\bam\bme\be:_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be or _\bm_\ba_\bc_\br_\bo, _\bk_\be_\by_\bn_\ba_\bm_\be is the name
aac48392
SS
118 of a key spelled out in English. For example:
119
120 Control-u: universal-argument
121 Meta-Rubout: backward-kill-word
122 Control-o: ">&output"
123
124 In the above example, _\bC_\b-_\bu is bound to the function u\bun\bni\biv\bve\ber\br-\b-
f9267e15
EZ
125 s\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt, _\bM_\b-_\bD_\bE_\bL is bound to the function b\bba\bac\bck\bk-\b-
126 w\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd, and _\bC_\b-_\bo is bound to run the macro
aac48392
SS
127
128
129
f9267e15 130GNU 1999 Jun 1 2
aac48392
SS
131
132
133
134
135
136READLINE(3) READLINE(3)
137
138
f9267e15
EZ
139 expressed on the right hand side (that is, to insert the
140 text _\b>_\b&_\bo_\bu_\bt_\bp_\bu_\bt into the line).
141
142 In the second form, "\b"k\bke\bey\bys\bse\beq\bq"\b":_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\b-_\bn_\ba_\bm_\be or _\bm_\ba_\bc_\br_\bo, k\bke\bey\by-\b-
aac48392 143 s\bse\beq\bq differs from k\bke\bey\byn\bna\bam\bme\be above in that strings denoting an
f9267e15
EZ
144 entire key sequence may be specified by placing the
145 sequence within double quotes. Some GNU Emacs style key
aac48392
SS
146 escapes can be used, as in the following example.
147
148 "\C-u": universal-argument
149 "\C-x\C-r": re-read-init-file
150 "\e[11~": "Function Key 1"
151
f9267e15
EZ
152 In this example, _\bC_\b-_\bu is again bound to the function u\bun\bni\bi-\b-
153 v\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt. _\bC_\b-_\bx _\bC_\b-_\br is bound to the function
154 r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be, and _\bE_\bS_\bC _\b[ _\b1 _\b1 _\b~ is bound to insert the
155 text F\bFu\bun\bnc\bct\bti\bio\bon\bn K\bKe\bey\by 1\b1. The full set of GNU Emacs style
aac48392
SS
156 escape sequences is
157 \\b\C\bC-\b- control prefix
158 \\b\M\bM-\b- meta prefix
159 \\b\e\be an escape character
160 \\b\\\b\ backslash
161 \\b\"\b" literal "
162 \\b\'\b' literal '
163
f9267e15 164 In addition to the GNU Emacs style escape sequences, a
aac48392
SS
165 second set of backslash escapes is available:
166 \\b\a\ba alert (bell)
167 \\b\b\bb backspace
168 \\b\d\bd delete
169 \\b\f\bf form feed
170 \\b\n\bn newline
171 \\b\r\br carriage return
172 \\b\t\bt horizontal tab
173 \\b\v\bv vertical tab
f9267e15 174 \\b\_\bn_\bn_\bn the character whose ASCII code is the octal
aac48392 175 value _\bn_\bn_\bn (one to three digits)
f9267e15 176 \\b\x\bx_\bn_\bn_\bn the character whose ASCII code is the hex-
aac48392
SS
177 adecimal value _\bn_\bn_\bn (one to three digits)
178
179 When entering the text of a macro, single or double quotes
f9267e15 180 should be used to indicate a macro definition. Unquoted
aac48392
SS
181 text is assumed to be a function name. In the macro body,
182 the backslash escapes described above are expanded. Back-
f9267e15 183 slash will quote any other character in the macro text,
aac48392
SS
184 including " and '.
185
f9267e15
EZ
186 B\bBa\bas\bsh\bh allows the current readline key bindings to be dis-
187 played or modified with the b\bbi\bin\bnd\bd builtin command. The
188 editing mode may be switched during interactive use by
189 using the -\b-o\bo option to the s\bse\bet\bt builtin command. Other
190 programs using this library provide similar mechanisms.
191 The _\bi_\bn_\bp_\bu_\bt_\br_\bc file may be edited and re-read if a program
192 does not provide any other means to incorporate new
aac48392
SS
193
194
195
f9267e15 196GNU 1999 Jun 1 3
aac48392
SS
197
198
199
200
201
202READLINE(3) READLINE(3)
203
204
f9267e15
EZ
205 bindings.
206
aac48392 207 V\bVa\bar\bri\bia\bab\bbl\ble\bes\bs
f9267e15 208 Readline has variables that can be used to further cus-
aac48392
SS
209 tomize its behavior. A variable may be set in the _\bi_\bn_\bp_\bu_\bt_\br_\bc
210 file with a statement of the form
211
212 s\bse\bet\bt _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be_\b-_\bn_\ba_\bm_\be _\bv_\ba_\bl_\bu_\be
213
214 Except where noted, readline variables can take the values
215 O\bOn\bn or O\bOf\bff\bf. The variables and their default values are:
216
217 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be (\b(a\bau\bud\bdi\bib\bbl\ble\be)\b)
f9267e15
EZ
218 Controls what happens when readline wants to ring
219 the terminal bell. If set to n\bno\bon\bne\be, readline never
aac48392 220 rings the bell. If set to v\bvi\bis\bsi\bib\bbl\ble\be, readline uses a
f9267e15 221 visible bell if one is available. If set to a\bau\bud\bdi\bi-\b-
aac48392
SS
222 b\bbl\ble\be, readline attempts to ring the terminal's bell.
223 c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn (\b(`\b``\b`#\b#'\b''\b')\b)
f9267e15
EZ
224 The string that is inserted in v\bvi\bi mode when the
225 i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt command is executed. This command
226 is bound to M\bM-\b-#\b# in emacs mode and to #\b# in vi com-
aac48392
SS
227 mand mode.
228 c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-i\big\bgn\bno\bor\bre\be-\b-c\bca\bas\bse\be (\b(O\bOf\bff\bf)\b)
f9267e15 229 If set to O\bOn\bn, readline performs filename matching
aac48392
SS
230 and completion in a case-insensitive fashion.
231 c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-q\bqu\bue\ber\bry\by-\b-i\bit\bte\bem\bms\bs (\b(1\b10\b00\b0)\b)
f9267e15
EZ
232 This determines when the user is queried about
233 viewing the number of possible completions gener-
234 ated by the p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs command. It may
235 be set to any integer value greater than or equal
236 to zero. If the number of possible completions is
237 greater than or equal to the value of this vari-
aac48392 238 able, the user is asked whether or not he wishes to
f9267e15 239 view them; otherwise they are simply listed on the
aac48392
SS
240 terminal.
241 c\bco\bon\bnv\bve\ber\brt\bt-\b-m\bme\bet\bta\ba (\b(O\bOn\bn)\b)
242 If set to O\bOn\bn, readline will convert characters with
f9267e15
EZ
243 the eighth bit set to an ASCII key sequence by
244 stripping the eighth bit and prepending an escape
aac48392
SS
245 character (in effect, using escape as the _\bm_\be_\bt_\ba _\bp_\br_\be_\b-
246 _\bf_\bi_\bx).
247 d\bdi\bis\bsa\bab\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn (\b(O\bOf\bff\bf)\b)
f9267e15
EZ
248 If set to O\bOn\bn, readline will inhibit word comple-
249 tion. Completion characters will be inserted into
aac48392
SS
250 the line as if they had been mapped to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt.
251 e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(e\bem\bma\bac\bcs\bs)\b)
f9267e15
EZ
252 Controls whether readline begins with a set of key
253 bindings similar to _\be_\bm_\ba_\bc_\bs or _\bv_\bi. e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be can
aac48392
SS
254 be set to either e\bem\bma\bac\bcs\bs or v\bvi\bi.
255 e\ben\bna\bab\bbl\ble\be-\b-k\bke\bey\byp\bpa\bad\bd (\b(O\bOf\bff\bf)\b)
f9267e15 256 When set to O\bOn\bn, readline will try to enable the
aac48392
SS
257 application keypad when it is called. Some systems
258 need this to enable the arrow keys.
aac48392
SS
259
260
261
f9267e15 262GNU 1999 Jun 1 4
aac48392
SS
263
264
265
266
267
268READLINE(3) READLINE(3)
269
270
f9267e15
EZ
271 e\bex\bxp\bpa\ban\bnd\bd-\b-t\bti\bil\bld\bde\be (\b(O\bOf\bff\bf)\b)
272 If set to o\bon\bn, tilde expansion is performed when
aac48392
SS
273 readline attempts word completion.
274 h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bl-\b-s\bsc\bcr\bro\bol\bll\bl-\b-m\bmo\bod\bde\be (\b(O\bOf\bff\bf)\b)
f9267e15
EZ
275 When set to O\bOn\bn, makes readline use a single line
276 for display, scrolling the input horizontally on a
277 single screen line when it becomes longer than the
aac48392 278 screen width rather than wrapping to a new line.
c862e87b 279 i\bin\bnp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
f9267e15
EZ
280 If set to O\bOn\bn, readline will enable eight-bit input
281 (that is, it will not strip the high bit from the
c862e87b
JM
282 characters it reads), regardless of what the termi-
283 nal claims it can support. The name m\bme\bet\bta\ba-\b-f\bfl\bla\bag\bg is a
284 synonym for this variable.
285 i\bis\bse\bea\bar\brc\bch\bh-\b-t\bte\ber\brm\bmi\bin\bna\bat\bto\bor\brs\bs (\b(`\b``\b`C\bC-\b-[\b[C\bC-\b-J\bJ'\b''\b')\b)
f9267e15
EZ
286 The string of characters that should terminate an
287 incremental search without subsequently executing
288 the character as a command. If this variable has
289 not been given a value, the characters _\bE_\bS_\bC and _\bC_\b-_\bJ
c862e87b 290 will terminate an incremental search.
aac48392 291 k\bke\bey\bym\bma\bap\bp (\b(e\bem\bma\bac\bcs\bs)\b)
f9267e15
EZ
292 Set the current readline keymap. The set of legal
293 keymap names is _\be_\bm_\ba_\bc_\bs_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd_\b, _\be_\bm_\ba_\bc_\bs_\b-_\bm_\be_\bt_\ba_\b,
aac48392
SS
294 _\be_\bm_\ba_\bc_\bs_\b-_\bc_\bt_\bl_\bx_\b, _\bv_\bi_\b, _\bv_\bi_\b-_\bm_\bo_\bv_\be_\b, _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd, and _\bv_\bi_\b-_\bi_\bn_\bs_\be_\br_\bt.
295 _\bv_\bi is equivalent to _\bv_\bi_\b-_\bc_\bo_\bm_\bm_\ba_\bn_\bd; _\be_\bm_\ba_\bc_\bs is equivalent
296 to _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd. The default value is _\be_\bm_\ba_\bc_\bs; the
f9267e15 297 value of e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be also affects the default
aac48392
SS
298 keymap.
299 m\bma\bar\brk\bk-\b-d\bdi\bir\bre\bec\bct\bto\bor\bri\bie\bes\bs (\b(O\bOn\bn)\b)
f9267e15 300 If set to O\bOn\bn, complete<d directory names have a
aac48392
SS
301 slash appended.
302 m\bma\bar\brk\bk-\b-m\bmo\bod\bdi\bif\bfi\bie\bed\bd-\b-l\bli\bin\bne\bes\bs (\b(O\bOf\bff\bf)\b)
303 If set to O\bOn\bn, history lines that have been modified
304 are displayed with a preceding asterisk (*\b*).
aac48392
SS
305 o\bou\but\btp\bpu\but\bt-\b-m\bme\bet\bta\ba (\b(O\bOf\bff\bf)\b)
306 If set to O\bOn\bn, readline will display characters with
f9267e15 307 the eighth bit set directly rather than as a meta-
aac48392
SS
308 prefixed escape sequence.
309 p\bpr\bri\bin\bnt\bt-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs-\b-h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bll\bly\by (\b(O\bOf\bff\bf)\b)
f9267e15
EZ
310 If set to O\bOn\bn, readline will display completions
311 with matches sorted horizontally in alphabetical
aac48392
SS
312 order, rather than down the screen.
313 s\bsh\bho\bow\bw-\b-a\bal\bll\bl-\b-i\bif\bf-\b-a\bam\bmb\bbi\big\bgu\buo\bou\bus\bs (\b(O\bOf\bff\bf)\b)
f9267e15
EZ
314 This alters the default behavior of the completion
315 functions. If set to o\bon\bn, words which have more
316 than one possible completion cause the matches to
317 be listed immediately instead of ringing the bell.
aac48392
SS
318 v\bvi\bis\bsi\bib\bbl\ble\be-\b-s\bst\bta\bat\bts\bs (\b(O\bOf\bff\bf)\b)
319 If set to O\bOn\bn, a character denoting a file's type as
f9267e15 320 reported by s\bst\bta\bat\bt(2) is appended to the filename
aac48392
SS
321 when listing possible completions.
322
323 C\bCo\bon\bnd\bdi\bit\bti\bio\bon\bna\bal\bl C\bCo\bon\bns\bst\btr\bru\buc\bct\bts\bs
f9267e15 324 Readline implements a facility similar in spirit to the
aac48392
SS
325
326
327
f9267e15 328GNU 1999 Jun 1 5
aac48392
SS
329
330
331
332
333
334READLINE(3) READLINE(3)
335
336
f9267e15
EZ
337 conditional compilation features of the C preprocessor
338 which allows key bindings and variable settings to be per-
339 formed as the result of tests. There are four parser
c862e87b
JM
340 directives used.
341
f9267e15
EZ
342 $\b$i\bif\bf The $\b$i\bif\bf construct allows bindings to be made based
343 on the editing mode, the terminal being used, or
344 the application using readline. The text of the
345 test extends to the end of the line; no characters
aac48392
SS
346 are required to isolate it.
347
f9267e15
EZ
348 m\bmo\bod\bde\be The m\bmo\bod\bde\be=\b= form of the $\b$i\bif\bf directive is used
349 to test whether readline is in emacs or vi
350 mode. This may be used in conjunction with
aac48392 351 the s\bse\bet\bt k\bke\bey\bym\bma\bap\bp command, for instance, to set
f9267e15
EZ
352 bindings in the _\be_\bm_\ba_\bc_\bs_\b-_\bs_\bt_\ba_\bn_\bd_\ba_\br_\bd and _\be_\bm_\ba_\bc_\bs_\b-
353 _\bc_\bt_\bl_\bx keymaps only if readline is starting
aac48392
SS
354 out in emacs mode.
355
356 t\bte\ber\brm\bm The t\bte\ber\brm\bm=\b= form may be used to include termi-
f9267e15
EZ
357 nal-specific key bindings, perhaps to bind
358 the key sequences output by the terminal's
359 function keys. The word on the right side
360 of the =\b= is tested against the full name of
aac48392
SS
361 the terminal and the portion of the terminal
362 name before the first -\b-. This allows _\bs_\bu_\bn to
363 match both _\bs_\bu_\bn and _\bs_\bu_\bn_\b-_\bc_\bm_\bd, for instance.
364
365 a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn
366 The a\bap\bpp\bpl\bli\bic\bca\bat\bti\bio\bon\bn construct is used to include
367 application-specific settings. Each program
368 using the readline library sets the _\ba_\bp_\bp_\bl_\bi_\bc_\ba_\b-
f9267e15
EZ
369 _\bt_\bi_\bo_\bn _\bn_\ba_\bm_\be, and an initialization file can
370 test for a particular value. This could be
aac48392 371 used to bind key sequences to functions use-
f9267e15
EZ
372 ful for a specific program. For instance,
373 the following command adds a key sequence
374 that quotes the current or previous word in
aac48392
SS
375 Bash:
376
377 $\b$i\bif\bf bash
378 # Quote the current or previous word
379 "\C-xq": "\eb\"\ef\""
380 $\b$e\ben\bnd\bdi\bif\bf
381
382 $\b$e\ben\bnd\bdi\bif\bf This command, as seen in the previous example, ter-
383 minates an $\b$i\bif\bf command.
384
f9267e15 385 $\b$e\bel\bls\bse\be Commands in this branch of the $\b$i\bif\bf directive are
aac48392
SS
386 executed if the test fails.
387
388 $\b$i\bin\bnc\bcl\blu\bud\bde\be
f9267e15
EZ
389 This directive takes a single filename as an argu-
390 ment and reads commands and bindings from that
aac48392 391
aac48392
SS
392
393
f9267e15 394GNU 1999 Jun 1 6
aac48392
SS
395
396
397
398
399
400READLINE(3) READLINE(3)
401
402
f9267e15
EZ
403 file. For example, the following directive would
404 read _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc:
405
c862e87b
JM
406 $\b$i\bin\bnc\bcl\blu\bud\bde\be _\b/_\be_\bt_\bc_\b/_\bi_\bn_\bp_\bu_\bt_\br_\bc
407
408S\bSE\bEA\bAR\bRC\bCH\bHI\bIN\bNG\bG
f9267e15
EZ
409 Readline provides commands for searching through the com-
410 mand history for lines containing a specified string.
411 There are two search modes: _\bi_\bn_\bc_\br_\be_\bm_\be_\bn_\bt_\ba_\bl and _\bn_\bo_\bn_\b-_\bi_\bn_\bc_\br_\be_\bm_\be_\bn_\b-
c862e87b 412 _\bt_\ba_\bl.
aac48392 413
f9267e15 414 Incremental searches begin before the user has finished
aac48392
SS
415 typing the search string. As each character of the search
416 string is typed, readline displays the next entry from the
f9267e15
EZ
417 history matching the string typed so far. An incremental
418 search requires only as many characters as needed to find
419 the desired history entry. The characters present in the
c862e87b 420 value of the _\bi_\bs_\be_\ba_\br_\bc_\bh_\b-_\bt_\be_\br_\bm_\bi_\bn_\ba_\bt_\bo_\br_\bs variable are used to ter-
f9267e15
EZ
421 minate an incremental search. If that variable has not
422 been assigned a value the Escape and Control-J characters
423 will terminate an incremental search. Control-G will
c862e87b 424 abort an incremental search and restore the original line.
f9267e15
EZ
425 When the search is terminated, the history entry contain-
426 ing the search string becomes the current line. To find
c862e87b
JM
427 other matching entries in the history list, type Control-S
428 or Control-R as appropriate. This will search backward or
f9267e15
EZ
429 forward in the history for the next line matching the
430 search string typed so far. Any other key sequence bound
431 to a readline command will terminate the search and exe-
c862e87b
JM
432 cute that command. For instance, a _\bn_\be_\bw_\bl_\bi_\bn_\be will terminate
433 the search and accept the line, thereby executing the com-
434 mand from the history list.
435
f9267e15 436 Non-incremental searches read the entire search string
aac48392 437 before starting to search for matching history lines. The
f9267e15 438 search string may be typed by the user or be part of the
aac48392
SS
439 contents of the current line.
440
441E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
f9267e15
EZ
442 The following is a list of the names of the commands and
443 the default key sequences to which they are bound. Com-
aac48392
SS
444 mand names without an accompanying key sequence are
445 unbound by default.
446
447 C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMo\bov\bvi\bin\bng\bg
448 b\bbe\beg\bgi\bin\bnn\bni\bin\bng\bg-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-a\ba)\b)
449 Move to the start of the current line.
450 e\ben\bnd\bd-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-e\be)\b)
451 Move to the end of the line.
452 f\bfo\bor\brw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-f\bf)\b)
453 Move forward a character.
454 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-b\bb)\b)
455 Move back a character.
aac48392
SS
456
457
458
f9267e15
EZ
459
460GNU 1999 Jun 1 7
aac48392
SS
461
462
463
464
465
466READLINE(3) READLINE(3)
467
468
f9267e15
EZ
469 f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-f\bf)\b)
470 Move forward to the end of the next word. Words
471 are composed of alphanumeric characters (letters
472 and digits).
c862e87b 473 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-b\bb)\b)
f9267e15
EZ
474 Move back to the start of the current or previous
475 word. Words are composed of alphanumeric charac-
c862e87b
JM
476 ters (letters and digits).
477 c\bcl\ble\bea\bar\br-\b-s\bsc\bcr\bre\bee\ben\bn (\b(C\bC-\b-l\bl)\b)
f9267e15
EZ
478 Clear the screen leaving the current line at the
479 top of the screen. With an argument, refresh the
c862e87b 480 current line without clearing the screen.
aac48392
SS
481 r\bre\bed\bdr\bra\baw\bw-\b-c\bcu\bur\brr\bre\ben\bnt\bt-\b-l\bli\bin\bne\be
482 Refresh the current line.
483
484 C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMa\ban\bni\bip\bpu\bul\bla\bat\bti\bin\bng\bg t\bth\bhe\be H\bHi\bis\bst\bto\bor\bry\by
485 a\bac\bcc\bce\bep\bpt\bt-\b-l\bli\bin\bne\be (\b(N\bNe\bew\bwl\bli\bin\bne\be,\b, R\bRe\bet\btu\bur\brn\bn)\b)
f9267e15
EZ
486 Accept the line regardless of where the cursor is.
487 If this line is non-empty, add it to the history
488 list. If the line is a modified history line, then
aac48392
SS
489 restore the history line to its original state.
490 p\bpr\bre\bev\bvi\bio\bou\bus\bs-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-p\bp)\b)
f9267e15 491 Fetch the previous command from the history list,
aac48392
SS
492 moving back in the list.
493 n\bne\bex\bxt\bt-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-n\bn)\b)
f9267e15 494 Fetch the next command from the history list, mov-
aac48392
SS
495 ing forward in the list.
496 b\bbe\beg\bgi\bin\bnn\bni\bin\bng\bg-\b-o\bof\bf-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-<\b<)\b)
497 Move to the first line in the history.
498 e\ben\bnd\bd-\b-o\bof\bf-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b->\b>)\b)
f9267e15 499 Move to the end of the input history, i.e., the
aac48392
SS
500 line currently being entered.
501 r\bre\bev\bve\ber\brs\bse\be-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-r\br)\b)
f9267e15 502 Search backward starting at the current line and
aac48392
SS
503 moving `up' through the history as necessary. This
504 is an incremental search.
505 f\bfo\bor\brw\bwa\bar\brd\bd-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(C\bC-\b-s\bs)\b)
f9267e15
EZ
506 Search forward starting at the current line and
507 moving `down' through the history as necessary.
aac48392
SS
508 This is an incremental search.
509 n\bno\bon\bn-\b-i\bin\bnc\bcr\bre\bem\bme\ben\bnt\bta\bal\bl-\b-r\bre\bev\bve\ber\brs\bse\be-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-p\bp)\b)
510 Search backward through the history starting at the
f9267e15 511 current line using a non-incremental search for a
aac48392
SS
512 string supplied by the user.
513 n\bno\bon\bn-\b-i\bin\bnc\bcr\bre\bem\bme\ben\bnt\bta\bal\bl-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-s\bse\bea\bar\brc\bch\bh-\b-h\bhi\bis\bst\bto\bor\bry\by (\b(M\bM-\b-n\bn)\b)
f9267e15
EZ
514 Search forward through the history using a non-
515 incremental search for a string supplied by the
aac48392
SS
516 user.
517 h\bhi\bis\bst\bto\bor\bry\by-\b-s\bse\bea\bar\brc\bch\bh-\b-f\bfo\bor\brw\bwa\bar\brd\bd
f9267e15 518 Search forward through the history for the string
aac48392 519 of characters between the start of the current line
f9267e15 520 and the current cursor position (the _\bp_\bo_\bi_\bn_\bt). This
aac48392 521 is a non-incremental search.
aac48392
SS
522
523
524
525
f9267e15 526GNU 1999 Jun 1 8
aac48392
SS
527
528
529
530
531
532READLINE(3) READLINE(3)
533
534
f9267e15
EZ
535 h\bhi\bis\bst\bto\bor\bry\by-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
536 Search backward through the history for the string
537 of characters between the start of the current line
538 and the point. This is a non-incremental search.
c862e87b 539 y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg (\b(M\bM-\b-C\bC-\b-y\by)\b)
f9267e15
EZ
540 Insert the first argument to the previous command
541 (usually the second word on the previous line) at
c862e87b 542 point (the current cursor position). With an argu-
f9267e15
EZ
543 ment _\bn, insert the _\bnth word from the previous com-
544 mand (the words in the previous command begin with
545 word 0). A negative argument inserts the _\bnth word
c862e87b 546 from the end of the previous command.
aac48392 547 y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg (\b(M\bM-\b-.\b.,\b, M\bM-\b-_\b_)\b)
f9267e15
EZ
548 Insert the last argument to the previous command
549 (the last word of the previous history entry).
aac48392
SS
550 With an argument, behave exactly like y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg.
551 Successive calls to y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg move back through
f9267e15 552 the history list, inserting the last argument of
aac48392
SS
553 each line in turn.
554
555 C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br C\bCh\bha\ban\bng\bgi\bin\bng\bg T\bTe\bex\bxt\bt
556 d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(C\bC-\b-d\bd)\b)
557 Delete the character under the cursor. If point is
f9267e15
EZ
558 at the beginning of the line, there are no charac-
559 ters in the line, and the last character typed was
aac48392
SS
560 not bound to B\bBd\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br, then return E\bEO\bOF\bF.
561 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(R\bRu\bub\bbo\bou\but\bt)\b)
562 Delete the character behind the cursor. When given
f9267e15 563 a numeric argument, save the deleted text on the
aac48392 564 kill ring.
c862e87b 565 f\bfo\bor\brw\bwa\bar\brd\bd-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br
f9267e15 566 Delete the character under the cursor, unless the
c862e87b 567 cursor is at the end of the line, in which case the
f9267e15 568 character behind the cursor is deleted. By
c862e87b 569 default, this is not bound to a key.
aac48392 570 q\bqu\buo\bot\bte\bed\bd-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-q\bq,\b, C\bC-\b-v\bv)\b)
f9267e15
EZ
571 Add the next character that you type to the line
572 verbatim. This is how to insert characters like
aac48392
SS
573 C\bC-\b-q\bq, for example.
574 t\bta\bab\bb-\b-i\bin\bns\bse\ber\brt\bt (\b(M\bM-\b-T\bTA\bAB\bB)\b)
575 Insert a tab character.
576 s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt (\b(a\ba,\b, b\bb,\b, A\bA,\b, 1\b1,\b, !\b!,\b, .\b..\b..\b.)\b)
577 Insert the character typed.
578 t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-c\bch\bha\bar\brs\bs (\b(C\bC-\b-t\bt)\b)
f9267e15
EZ
579 Drag the character before point forward over the
580 character at point. Point moves forward as well.
581 If point is at the end of the line, then transpose
582 the two characters before point. Negative argu-
aac48392
SS
583 ments don't work.
584 t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-w\bwo\bor\brd\bds\bs (\b(M\bM-\b-t\bt)\b)
f9267e15
EZ
585 Drag the word behind the cursor past the word in
586 front of the cursor moving the cursor over that
aac48392 587 word as well.
c862e87b
JM
588
589
590
591
f9267e15 592GNU 1999 Jun 1 9
c862e87b
JM
593
594
595
596
597
598READLINE(3) READLINE(3)
599
600
f9267e15
EZ
601 u\bup\bpc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-u\bu)\b)
602 Uppercase the current (or following) word. With a
603 negative argument, uppercase the previous word, but
604 do not move point.
aac48392 605 d\bdo\bow\bwn\bnc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-l\bl)\b)
f9267e15 606 Lowercase the current (or following) word. With a
aac48392
SS
607 negative argument, lowercase the previous word, but
608 do not move point.
609 c\bca\bap\bpi\bit\bta\bal\bli\biz\bze\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-c\bc)\b)
610 Capitalize the current (or following) word. With a
f9267e15 611 negative argument, capitalize the previous word,
aac48392
SS
612 but do not move point.
613
614 K\bKi\bil\bll\bli\bin\bng\bg a\ban\bnd\bd Y\bYa\ban\bnk\bki\bin\bng\bg
615 k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-k\bk)\b)
f9267e15 616 Kill the text from the current cursor position to
aac48392 617 the end of the line.
aac48392
SS
618 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-x\bx R\bRu\bub\bbo\bou\but\bt)\b)
619 Kill backward to the beginning of the line.
620 u\bun\bni\bix\bx-\b-l\bli\bin\bne\be-\b-d\bdi\bis\bsc\bca\bar\brd\bd (\b(C\bC-\b-u\bu)\b)
f9267e15 621 Kill backward from point to the beginning of the
aac48392
SS
622 line. The killed text is saved on the kill-ring.
623 k\bki\bil\bll\bl-\b-w\bwh\bho\bol\ble\be-\b-l\bli\bin\bne\be
f9267e15 624 Kill all characters on the current line, no matter
aac48392
SS
625 where the cursor is.
626 k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-d\bd)\b)
f9267e15
EZ
627 Kill from the cursor to the end of the current
628 word, or if between words, to the end of the next
629 word. Word boundaries are the same as those used
aac48392
SS
630 by f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
631 b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-R\bRu\bub\bbo\bou\but\bt)\b)
f9267e15 632 Kill the word behind the cursor. Word boundaries
aac48392
SS
633 are the same as those used by b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
634 u\bun\bni\bix\bx-\b-w\bwo\bor\brd\bd-\b-r\bru\bub\bbo\bou\but\bt (\b(C\bC-\b-w\bw)\b)
f9267e15
EZ
635 Kill the word behind the cursor, using white space
636 as a word boundary. The word boundaries are dif-
aac48392
SS
637 ferent from b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd.
638 d\bde\bel\ble\bet\bte\be-\b-h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bl-\b-s\bsp\bpa\bac\bce\be (\b(M\bM-\b-\\b\)\b)
639 Delete all spaces and tabs around point.
640 k\bki\bil\bll\bl-\b-r\bre\beg\bgi\bio\bon\bn
f9267e15
EZ
641 Kill the text between the point and _\bm_\ba_\br_\bk (saved
642 cursor position). This text is referred to as the
aac48392
SS
643 _\br_\be_\bg_\bi_\bo_\bn.
644 c\bco\bop\bpy\by-\b-r\bre\beg\bgi\bio\bon\bn-\b-a\bas\bs-\b-k\bki\bil\bll\bl
645 Copy the text in the region to the kill buffer.
646 c\bco\bop\bpy\by-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
647 Copy the word before point to the kill buffer. The
648 word boundaries are the same as b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
649 c\bco\bop\bpy\by-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
f9267e15 650 Copy the word following point to the kill buffer.
aac48392
SS
651 The word boundaries are the same as f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
652 y\bya\ban\bnk\bk (\b(C\bC-\b-y\by)\b)
f9267e15 653 Yank the top of the kill ring into the buffer at
aac48392 654 the cursor.
aac48392 655
c862e87b
JM
656
657
f9267e15 658GNU 1999 Jun 1 10
c862e87b
JM
659
660
661
662
663
664READLINE(3) READLINE(3)
665
666
f9267e15
EZ
667 y\bya\ban\bnk\bk-\b-p\bpo\bop\bp (\b(M\bM-\b-y\by)\b)
668 Rotate the kill ring, and yank the new top. Only
669 works following y\bya\ban\bnk\bk or y\bya\ban\bnk\bk-\b-p\bpo\bop\bp.
670
aac48392
SS
671 N\bNu\bum\bme\ber\bri\bic\bc A\bAr\brg\bgu\bum\bme\ben\bnt\bts\bs
672 d\bdi\big\bgi\bit\bt-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt (\b(M\bM-\b-0\b0,\b, M\bM-\b-1\b1,\b, .\b..\b..\b.,\b, M\bM-\b--\b-)\b)
f9267e15
EZ
673 Add this digit to the argument already accumulat-
674 ing, or start a new argument. M-- starts a nega-
aac48392
SS
675 tive argument.
676 u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt
f9267e15
EZ
677 This is another way to specify an argument. If
678 this command is followed by one or more digits,
679 optionally with a leading minus sign, those digits
aac48392
SS
680 define the argument. If the command is followed by
681 digits, executing u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt again ends the
f9267e15
EZ
682 numeric argument, but is otherwise ignored. As a
683 special case, if this command is immediately fol-
684 lowed by a character that is neither a digit or
aac48392 685 minus sign, the argument count for the next command
f9267e15
EZ
686 is multiplied by four. The argument count is ini-
687 tially one, so executing this function the first
688 time makes the argument count four, a second time
aac48392
SS
689 makes the argument count sixteen, and so on.
690
691 C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg
692 c\bco\bom\bmp\bpl\ble\bet\bte\be (\b(T\bTA\bAB\bB)\b)
f9267e15 693 Attempt to perform completion on the text before
aac48392 694 point. The actual completion performed is applica-
f9267e15
EZ
695 tion-specific. B\bBa\bas\bsh\bh, for instance, attempts com-
696 pletion treating the text as a variable (if the
697 text begins with $\b$), username (if the text begins
698 with ~\b~), hostname (if the text begins with @\b@), or
699 command (including aliases and functions) in turn.
aac48392 700 If none of these produces a match, filename comple-
f9267e15
EZ
701 tion is attempted. G\bGd\bdb\bb, on the other hand, allows
702 completion of program functions and variables, and
703 only attempts filename completion under certain
aac48392
SS
704 circumstances.
705 p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-?\b?)\b)
f9267e15 706 List the possible completions of the text before
aac48392
SS
707 point.
708 i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-*\b*)\b)
f9267e15
EZ
709 Insert all completions of the text before point
710 that would have been generated by p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\be-\b-
aac48392
SS
711 t\bti\bio\bon\bns\bs.
712 m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be
f9267e15 713 Similar to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be
aac48392
SS
714 completed with a single match from the list of pos-
715 sible completions. Repeated execution of m\bme\ben\bnu\bu-\b-c\bco\bom\bm-\b-
f9267e15 716 p\bpl\ble\bet\bte\be steps through the list of possible comple-
aac48392 717 tions, inserting each match in turn. At the end of
f9267e15
EZ
718 the list of completions, the bell is rung and the
719 original text is restored. An argument of _\bn moves
720 _\bn positions forward in the list of matches; a
aac48392
SS
721
722
723
f9267e15 724GNU 1999 Jun 1 11
aac48392
SS
725
726
aac48392
SS
727
728
729
c862e87b 730READLINE(3) READLINE(3)
aac48392
SS
731
732
f9267e15
EZ
733 negative argument may be used to move backward
734 through the list. This command is intended to be
735 bound to T\bTA\bAB\bB, but is unbound by default.
c862e87b 736 d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br-\b-o\bor\br-\b-l\bli\bis\bst\bt
f9267e15
EZ
737 Deletes the character under the cursor if not at
738 the beginning or end of the line (like d\bde\bel\ble\bet\bte\be-\b-
739 c\bch\bha\bar\br). If at the end of the line, behaves identi-
740 cally to p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs. This command is
c862e87b 741 unbound by default.
aac48392 742
c862e87b
JM
743 K\bKe\bey\byb\bbo\boa\bar\brd\bd M\bMa\bac\bcr\bro\bos\bs
744 s\bst\bta\bar\brt\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx (\b()\b)
f9267e15 745 Begin saving the characters typed into the current
c862e87b
JM
746 keyboard macro.
747 e\ben\bnd\bd-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx )\b))\b)
f9267e15 748 Stop saving the characters typed into the current
c862e87b
JM
749 keyboard macro and store the definition.
750 c\bca\bal\bll\bl-\b-l\bla\bas\bst\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx e\be)\b)
751 Re-execute the last keyboard macro defined, by mak-
f9267e15 752 ing the characters in the macro appear as if typed
c862e87b 753 at the keyboard.
aac48392
SS
754
755 M\bMi\bis\bsc\bce\bel\bll\bla\ban\bne\beo\bou\bus\bs
756 r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be (\b(C\bC-\b-x\bx C\bC-\b-r\br)\b)
f9267e15
EZ
757 Read in the contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file, and
758 incorporate any bindings or variable assignments
aac48392
SS
759 found there.
760 a\bab\bbo\bor\brt\bt (\b(C\bC-\b-g\bg)\b)
761 Abort the current editing command and ring the ter-
762 minal's bell (subject to the setting of
763 b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be).
764 d\bdo\bo-\b-u\bup\bpp\bpe\ber\brc\bca\bas\bse\be-\b-v\bve\ber\brs\bsi\bio\bon\bn (\b(M\bM-\b-a\ba,\b, M\bM-\b-b\bb,\b, M\bM-\b-_\bx,\b, .\b..\b..\b.)\b)
f9267e15
EZ
765 If the metafied character _\bx is lowercase, run the
766 command that is bound to the corresponding upper-
aac48392
SS
767 case character.
768 p\bpr\bre\bef\bfi\bix\bx-\b-m\bme\bet\bta\ba (\b(E\bES\bSC\bC)\b)
f9267e15 769 Metafy the next character typed. E\bES\bSC\bC f\bf is equiva-
aac48392
SS
770 lent to M\bMe\bet\bta\ba-\b-f\bf.
771 u\bun\bnd\bdo\bo (\b(C\bC-\b-_\b_,\b, C\bC-\b-x\bx C\bC-\b-u\bu)\b)
f9267e15 772 Incremental undo, separately remembered for each
aac48392
SS
773 line.
774 r\bre\bev\bve\ber\brt\bt-\b-l\bli\bin\bne\be (\b(M\bM-\b-r\br)\b)
f9267e15
EZ
775 Undo all changes made to this line. This is like
776 executing the u\bun\bnd\bdo\bo command enough times to return
aac48392 777 the line to its initial state.
c862e87b 778 t\bti\bil\bld\bde\be-\b-e\bex\bxp\bpa\ban\bnd\bd (\b(M\bM-\b-&\b&)\b)
aac48392
SS
779 Perform tilde expansion on the current word.
780 s\bse\bet\bt-\b-m\bma\bar\brk\bk (\b(C\bC-\b-@\b@,\b, M\bM-\b-<\b<s\bsp\bpa\bac\bce\be>\b>)\b)
f9267e15 781 Set the mark to the current point. If a numeric
aac48392
SS
782 argument is supplied, the mark is set to that posi-
783 tion.
784 e\bex\bxc\bch\bha\ban\bng\bge\be-\b-p\bpo\boi\bin\bnt\bt-\b-a\ban\bnd\bd-\b-m\bma\bar\brk\bk (\b(C\bC-\b-x\bx C\bC-\b-x\bx)\b)
f9267e15
EZ
785 Swap the point with the mark. The current cursor
786 position is set to the saved position, and the old
c862e87b
JM
787
788
789
f9267e15 790GNU 1999 Jun 1 12
c862e87b
JM
791
792
793
794
795
796READLINE(3) READLINE(3)
797
798
f9267e15
EZ
799 cursor position is saved as the mark.
800 c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh (\b(C\bC-\b-]\b])\b)
801 A character is read and point is moved to the next
802 occurrence of that character. A negative count
aac48392
SS
803 searches for previous occurrences.
804 c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd (\b(M\bM-\b-C\bC-\b-]\b])\b)
f9267e15
EZ
805 A character is read and point is moved to the pre-
806 vious occurrence of that character. A negative
aac48392
SS
807 count searches for subsequent occurrences.
808 i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt (\b(M\bM-\b-#\b#)\b)
809 The value of the readline c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn variable is
f9267e15
EZ
810 inserted at the beginning of the current line, and
811 the line is accepted as if a newline had been
812 typed. This makes the current line a shell com-
aac48392
SS
813 ment.
814 d\bdu\bum\bmp\bp-\b-f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs
f9267e15
EZ
815 Print all of the functions and their key bindings
816 to the readline output stream. If a numeric argu-
aac48392
SS
817 ment is supplied, the output is formatted in such a
818 way that it can be made part of an _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
819 d\bdu\bum\bmp\bp-\b-v\bva\bar\bri\bia\bab\bbl\ble\bes\bs
f9267e15
EZ
820 Print all of the settable variables and their val-
821 ues to the readline output stream. If a numeric
822 argument is supplied, the output is formatted in
823 such a way that it can be made part of an _\bi_\bn_\bp_\bu_\bt_\br_\bc
aac48392
SS
824 file.
825 d\bdu\bum\bmp\bp-\b-m\bma\bac\bcr\bro\bos\bs
f9267e15
EZ
826 Print all of the readline key sequences bound to
827 macros and the strings they ouput. If a numeric
828 argument is supplied, the output is formatted in
829 such a way that it can be made part of an _\bi_\bn_\bp_\bu_\bt_\br_\bc
aac48392
SS
830 file.
831 e\bem\bma\bac\bcs\bs-\b-e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(C\bC-\b-e\be)\b)
f9267e15 832 When in v\bvi\bi editing mode, this causes a switch to
aac48392
SS
833 e\bem\bma\bac\bcs\bs editing mode.
834 v\bvi\bi-\b-e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(M\bM-\b-C\bC-\b-j\bj)\b)
835 When in e\bem\bma\bac\bcs\bs editing mode, this causes a switch to
836 v\bvi\bi editing mode.
837
838D\bDE\bEF\bFA\bAU\bUL\bLT\bT K\bKE\bEY\bY B\bBI\bIN\bND\bDI\bIN\bNG\bGS\bS
f9267e15
EZ
839 The following is a list of the default emacs and vi bind-
840 ings. Characters with the 8th bit set are written as
aac48392 841 M-<character>, and are referred to as _\bm_\be_\bt_\ba_\bf_\bi_\be_\bd characters.
f9267e15
EZ
842 The printable ASCII characters not mentioned in the list
843 of emacs standard bindings are bound to the _\bs_\be_\bl_\bf_\b-_\bi_\bn_\bs_\be_\br_\bt
844 function, which just inserts the given character into the
845 input line. In vi insertion mode, all characters not
846 specifically mentioned are bound to _\bs_\be_\bl_\bf_\b-_\bi_\bn_\bs_\be_\br_\bt. Charac-
847 ters assigned to signal generation by _\bs_\bt_\bt_\by(1) or the ter-
848 minal driver, such as C-Z or C-C, retain that function.
849 Upper and lower case _\bm_\be_\bt_\ba_\bf_\bi_\be_\bd characters are bound to the
850 same function in the emacs mode meta keymap. The remain-
851 ing characters are unbound, which causes readline to ring
852 the bell (subject to the setting of the b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be
aac48392 853
c862e87b
JM
854
855
f9267e15 856GNU 1999 Jun 1 13
c862e87b
JM
857
858
859
860
861
862READLINE(3) READLINE(3)
863
864
f9267e15
EZ
865 variable).
866
aac48392
SS
867 E\bEm\bma\bac\bcs\bs M\bMo\bod\bde\be
868 Emacs Standard bindings
869
870 "C-@" set-mark
871 "C-A" beginning-of-line
872 "C-B" backward-char
873 "C-D" delete-char
874 "C-E" end-of-line
875 "C-F" forward-char
876 "C-G" abort
877 "C-H" backward-delete-char
878 "C-I" complete
879 "C-J" accept-line
880 "C-K" kill-line
881 "C-L" clear-screen
882 "C-M" accept-line
883 "C-N" next-history
884 "C-P" previous-history
885 "C-Q" quoted-insert
886 "C-R" reverse-search-history
aac48392
SS
887 "C-S" forward-search-history
888 "C-T" transpose-chars
889 "C-U" unix-line-discard
890 "C-V" quoted-insert
891 "C-W" unix-word-rubout
892 "C-Y" yank
893 "C-]" character-search
894 "C-_" undo
895 " " to "/" self-insert
896 "0" to "9" self-insert
897 ":" to "~" self-insert
898 "C-?" backward-delete-char
899
900 Emacs Meta bindings
901
902 "M-C-G" abort
903 "M-C-H" backward-kill-word
904 "M-C-I" tab-insert
905 "M-C-J" vi-editing-mode
906 "M-C-M" vi-editing-mode
907 "M-C-R" revert-line
908 "M-C-Y" yank-nth-arg
909 "M-C-[" complete
910 "M-C-]" character-search-backward
911 "M-space" set-mark
912 "M-#" insert-comment
913 "M-&" tilde-expand
914 "M-*" insert-completions
915 "M--" digit-argument
916 "M-." yank-last-arg
917 "M-0" digit-argument
918 "M-1" digit-argument
c862e87b
JM
919
920
921
f9267e15 922GNU 1999 Jun 1 14
c862e87b
JM
923
924
925
926
927
928READLINE(3) READLINE(3)
929
930
f9267e15
EZ
931 "M-2" digit-argument
932 "M-3" digit-argument
aac48392
SS
933 "M-4" digit-argument
934 "M-5" digit-argument
935 "M-6" digit-argument
936 "M-7" digit-argument
937 "M-8" digit-argument
938 "M-9" digit-argument
939 "M-<" beginning-of-history
940 "M-=" possible-completions
941 "M->" end-of-history
942 "M-?" possible-completions
943 "M-B" backward-word
944 "M-C" capitalize-word
945 "M-D" kill-word
946 "M-F" forward-word
947 "M-L" downcase-word
948 "M-N" non-incremental-forward-search-history
949 "M-P" non-incremental-reverse-search-history
950 "M-R" revert-line
951 "M-T" transpose-words
952 "M-U" upcase-word
aac48392
SS
953 "M-Y" yank-pop
954 "M-\" delete-horizontal-space
955 "M-~" tilde-expand
956 "M-C-?" backward-delete-word
957 "M-_" yank-last-arg
958
959 Emacs Control-X bindings
960
961 "C-XC-G" abort
962 "C-XC-R" re-read-init-file
963 "C-XC-U" undo
964 "C-XC-X" exchange-point-and-mark
965 "C-X(" start-kbd-macro
966 "C-X)" end-kbd-macro
967 "C-XE" call-last-kbd-macro
968 "C-XC-?" backward-kill-line
969
970
971 V\bVI\bI M\bMo\bod\bde\be b\bbi\bin\bnd\bdi\bin\bng\bgs\bs
972 VI Insert Mode functions
973
974 "C-D" vi-eof-maybe
975 "C-H" backward-delete-char
976 "C-I" complete
977 "C-J" accept-line
978 "C-M" accept-line
979 "C-R" reverse-search-history
980 "C-S" forward-search-history
981 "C-T" transpose-chars
982 "C-U" unix-line-discard
983 "C-V" quoted-insert
984 "C-W" unix-word-rubout
c862e87b
JM
985
986
987
f9267e15 988GNU 1999 Jun 1 15
c862e87b
JM
989
990
991
992
993
994READLINE(3) READLINE(3)
995
996
f9267e15
EZ
997 "C-Y" yank
998 "C-[" vi-movement-mode
aac48392
SS
999 "C-_" undo
1000 " " to "~" self-insert
1001 "C-?" backward-delete-char
1002
1003 VI Command Mode functions
1004
1005 "C-D" vi-eof-maybe
1006 "C-E" emacs-editing-mode
1007 "C-G" abort
1008 "C-H" backward-char
1009 "C-J" accept-line
1010 "C-K" kill-line
1011 "C-L" clear-screen
1012 "C-M" accept-line
1013 "C-N" next-history
1014 "C-P" previous-history
1015 "C-Q" quoted-insert
1016 "C-R" reverse-search-history
1017 "C-S" forward-search-history
1018 "C-T" transpose-chars
aac48392
SS
1019 "C-U" unix-line-discard
1020 "C-V" quoted-insert
1021 "C-W" unix-word-rubout
1022 "C-Y" yank
1023 " " forward-char
1024 "#" insert-comment
1025 "$" end-of-line
1026 "%" vi-match
1027 "&" vi-tilde-expand
1028 "*" vi-complete
1029 "+" next-history
1030 "," vi-char-search
1031 "-" previous-history
1032 "." vi-redo
1033 "/" vi-search
1034 "0" beginning-of-line
1035 "1" to "9" vi-arg-digit
1036 ";" vi-char-search
1037 "=" vi-complete
1038 "?" vi-search
1039 "A" vi-append-eol
1040 "B" vi-prev-word
1041 "C" vi-change-to
1042 "D" vi-delete-to
1043 "E" vi-end-word
1044 "F" vi-char-search
1045 "G" vi-fetch-history
1046 "I" vi-insert-beg
1047 "N" vi-search-again
1048 "P" vi-put
1049 "R" vi-replace
1050 "S" vi-subst
c862e87b
JM
1051
1052
1053
f9267e15 1054GNU 1999 Jun 1 16
c862e87b
JM
1055
1056
1057
1058
1059
1060READLINE(3) READLINE(3)
1061
1062
f9267e15
EZ
1063 "T" vi-char-search
1064 "U" revert-line
aac48392
SS
1065 "W" vi-next-word
1066 "X" backward-delete-char
1067 "Y" vi-yank-to
1068 "\" vi-complete
1069 "^" vi-first-print
1070 "_" vi-yank-arg
1071 "`" vi-goto-mark
1072 "a" vi-append-mode
1073 "b" vi-prev-word
1074 "c" vi-change-to
1075 "d" vi-delete-to
1076 "e" vi-end-word
1077 "f" vi-char-search
1078 "h" backward-char
1079 "i" vi-insertion-mode
1080 "j" next-history
1081 "k" prev-history
1082 "l" forward-char
1083 "m" vi-set-mark
1084 "n" vi-search-again
aac48392
SS
1085 "p" vi-put
1086 "r" vi-change-char
1087 "s" vi-subst
1088 "t" vi-char-search
1089 "u" undo
1090 "w" vi-next-word
1091 "x" vi-delete
1092 "y" vi-yank-to
1093 "|" vi-column
1094 "~" vi-change-case
1095
1096S\bSE\bEE\bE A\bAL\bLS\bSO\bO
1097 _\bT_\bh_\be _\bG_\bn_\bu _\bR_\be_\ba_\bd_\bl_\bi_\bn_\be _\bL_\bi_\bb_\br_\ba_\br_\by, Brian Fox and Chet Ramey
1098 _\bT_\bh_\be _\bG_\bn_\bu _\bH_\bi_\bs_\bt_\bo_\br_\by _\bL_\bi_\bb_\br_\ba_\br_\by, Brian Fox and Chet Ramey
1099 _\bb_\ba_\bs_\bh(1)
1100
1101F\bFI\bIL\bLE\bES\bS
1102 _\b~_\b/_\b._\bi_\bn_\bp_\bu_\bt_\br_\bc
1103 Individual r\bre\bea\bad\bdl\bli\bin\bne\be initialization file
1104
1105A\bAU\bUT\bTH\bHO\bOR\bRS\bS
f9267e15
EZ
1106 Brian Fox, Free Software Foundation
1107 bfox@gnu.org
aac48392
SS
1108
1109 Chet Ramey, Case Western Reserve University
1110 chet@ins.CWRU.Edu
1111
1112B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
f9267e15
EZ
1113 If you find a bug in r\bre\bea\bad\bdl\bli\bin\bne\be,\b, you should report it. But
1114 first, you should make sure that it really is a bug, and
1115 that it appears in the latest version of the r\bre\bea\bad\bdl\bli\bin\bne\be
aac48392
SS
1116 library that you have.
1117
c862e87b
JM
1118
1119
f9267e15 1120GNU 1999 Jun 1 17
c862e87b
JM
1121
1122
1123
1124
1125
1126READLINE(3) READLINE(3)
1127
1128
f9267e15
EZ
1129 Once you have determined that a bug actually exists, mail
1130 a bug report to _\bb_\bu_\bg_\b-_\br_\be_\ba_\bd_\bl_\bi_\bn_\be@_\bg_\bn_\bu_\b._\bo_\br_\bg. If you have a fix,
1131 you are welcome to mail that as well! Suggestions and
1132 `philosophical' bug reports may be mailed to _\bb_\bu_\bg_\b-_\br_\be_\ba_\bd_\b-
aac48392
SS
1133 _\bl_\bi_\bn_\be@_\bg_\bn_\bu_\b._\bo_\br_\bg or posted to the Usenet newsgroup
1134 g\bgn\bnu\bu.\b.b\bba\bas\bsh\bh.\b.b\bbu\bug\bg.
1135
f9267e15 1136 Comments and bug reports concerning this manual page
aac48392
SS
1137 should be directed to _\bc_\bh_\be_\bt_\b@_\bi_\bn_\bs_\b._\bC_\bW_\bR_\bU_\b._\bE_\bd_\bu.
1138
1139B\bBU\bUG\bGS\bS
1140 It's too big and too slow.
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
c862e87b
JM
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
f9267e15 1186GNU 1999 Jun 1 18
aac48392
SS
1187
1188
This page took 0.083487 seconds and 4 git commands to generate.