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