Commit | Line | Data |
---|---|---|
84041b4c | 1 | This is rluserman.info, produced by makeinfo version 4.1 from |
f9267e15 EZ |
2 | /usr/homes/chet/src/bash/readline-src/doc/rluserman.texinfo. |
3 | ||
4 | INFO-DIR-SECTION Libraries | |
5 | START-INFO-DIR-ENTRY | |
84041b4c | 6 | * RLuserman: (rluserman). The GNU readline library User's Manual. |
f9267e15 EZ |
7 | END-INFO-DIR-ENTRY |
8 | ||
9 | This document describes the end user interface of the GNU Readline | |
10 | Library, a utility which aids in the consistency of user interface | |
11 | across discrete programs that need to provide a command line interface. | |
12 | ||
84041b4c | 13 | Copyright (C) 1988-2002 Free Software Foundation, Inc. |
f9267e15 EZ |
14 | |
15 | Permission is granted to make and distribute verbatim copies of this | |
16 | manual provided the copyright notice and this permission notice pare | |
17 | preserved on all copies. | |
18 | ||
19 | Permission is granted to copy and distribute modified versions of | |
20 | this manual under the conditions for verbatim copying, provided that | |
21 | the entire resulting derived work is distributed under the terms of a | |
22 | permission notice identical to this one. | |
23 | ||
24 | Permission is granted to copy and distribute translations of this | |
25 | manual into another language, under the above conditions for modified | |
26 | versions, except that this permission notice may be stated in a | |
27 | translation approved by the Free Software Foundation. | |
28 | ||
29 | \1f | |
30 | File: rluserman.info, Node: Top, Next: Command Line Editing, Up: (dir) | |
31 | ||
32 | GNU Readline Library | |
33 | ******************** | |
34 | ||
35 | This document describes the end user interface of the GNU Readline | |
36 | Library, a utility which aids in the consistency of user interface | |
37 | across discrete programs that need to provide a command line interface. | |
38 | ||
39 | * Menu: | |
40 | ||
41 | * Command Line Editing:: GNU Readline User's Manual. | |
42 | ||
43 | \1f | |
44 | File: rluserman.info, Node: Command Line Editing, Prev: Top, Up: Top | |
45 | ||
46 | Command Line Editing | |
47 | ******************** | |
48 | ||
49 | This chapter describes the basic features of the GNU command line | |
50 | editing interface. | |
51 | ||
52 | * Menu: | |
53 | ||
54 | * Introduction and Notation:: Notation used in this text. | |
55 | * Readline Interaction:: The minimum set of commands for editing a line. | |
56 | * Readline Init File:: Customizing Readline from a user's view. | |
57 | * Bindable Readline Commands:: A description of most of the Readline commands | |
58 | available for binding | |
59 | * Readline vi Mode:: A short description of how to make Readline | |
60 | behave like the vi editor. | |
61 | ||
62 | \1f | |
63 | File: rluserman.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing | |
64 | ||
65 | Introduction to Line Editing | |
66 | ============================ | |
67 | ||
68 | The following paragraphs describe the notation used to represent | |
69 | keystrokes. | |
70 | ||
84041b4c | 71 | The text `C-k' is read as `Control-K' and describes the character |
f9267e15 EZ |
72 | produced when the <k> key is pressed while the Control key is depressed. |
73 | ||
84041b4c | 74 | The text `M-k' is read as `Meta-K' and describes the character |
f9267e15 EZ |
75 | produced when the Meta key (if you have one) is depressed, and the <k> |
76 | key is pressed. The Meta key is labeled <ALT> on many keyboards. On | |
77 | keyboards with two keys labeled <ALT> (usually to either side of the | |
78 | space bar), the <ALT> on the left side is generally set to work as a | |
79 | Meta key. The <ALT> key on the right may also be configured to work as | |
80 | a Meta key or may be configured as some other modifier, such as a | |
81 | Compose key for typing accented characters. | |
82 | ||
83 | If you do not have a Meta or <ALT> key, or another key working as a | |
84 | Meta key, the identical keystroke can be generated by typing <ESC> | |
84041b4c EZ |
85 | _first_, and then typing <k>. Either process is known as "metafying" |
86 | the <k> key. | |
f9267e15 | 87 | |
84041b4c EZ |
88 | The text `M-C-k' is read as `Meta-Control-k' and describes the |
89 | character produced by "metafying" `C-k'. | |
f9267e15 EZ |
90 | |
91 | In addition, several keys have their own names. Specifically, | |
92 | <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves | |
84041b4c EZ |
93 | when seen in this text, or in an init file (*note Readline Init File::). |
94 | If your keyboard lacks a <LFD> key, typing <C-j> will produce the | |
95 | desired character. The <RET> key may be labeled <Return> or <Enter> on | |
96 | some keyboards. | |
f9267e15 EZ |
97 | |
98 | \1f | |
99 | File: rluserman.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing | |
100 | ||
101 | Readline Interaction | |
102 | ==================== | |
103 | ||
104 | Often during an interactive session you type in a long line of text, | |
105 | only to notice that the first word on the line is misspelled. The | |
106 | Readline library gives you a set of commands for manipulating the text | |
107 | as you type it in, allowing you to just fix your typo, and not forcing | |
108 | you to retype the majority of the line. Using these editing commands, | |
109 | you move the cursor to the place that needs correction, and delete or | |
110 | insert the text of the corrections. Then, when you are satisfied with | |
84041b4c EZ |
111 | the line, you simply press <RET>. You do not have to be at the end of |
112 | the line to press <RET>; the entire line is accepted regardless of the | |
113 | location of the cursor within the line. | |
f9267e15 EZ |
114 | |
115 | * Menu: | |
116 | ||
117 | * Readline Bare Essentials:: The least you need to know about Readline. | |
118 | * Readline Movement Commands:: Moving about the input line. | |
119 | * Readline Killing Commands:: How to delete text, and how to get it back! | |
120 | * Readline Arguments:: Giving numeric arguments to commands. | |
121 | * Searching:: Searching through previous lines. | |
122 | ||
123 | \1f | |
124 | File: rluserman.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction | |
125 | ||
126 | Readline Bare Essentials | |
127 | ------------------------ | |
128 | ||
129 | In order to enter characters into the line, simply type them. The | |
130 | typed character appears where the cursor was, and then the cursor moves | |
131 | one space to the right. If you mistype a character, you can use your | |
132 | erase character to back up and delete the mistyped character. | |
133 | ||
134 | Sometimes you may mistype a character, and not notice the error | |
135 | until you have typed several other characters. In that case, you can | |
84041b4c EZ |
136 | type `C-b' to move the cursor to the left, and then correct your |
137 | mistake. Afterwards, you can move the cursor to the right with `C-f'. | |
f9267e15 EZ |
138 | |
139 | When you add text in the middle of a line, you will notice that | |
140 | characters to the right of the cursor are `pushed over' to make room | |
141 | for the text that you have inserted. Likewise, when you delete text | |
142 | behind the cursor, characters to the right of the cursor are `pulled | |
143 | back' to fill in the blank space created by the removal of the text. A | |
144 | list of the bare essentials for editing the text of an input line | |
145 | follows. | |
146 | ||
84041b4c | 147 | `C-b' |
f9267e15 EZ |
148 | Move back one character. |
149 | ||
84041b4c | 150 | `C-f' |
f9267e15 EZ |
151 | Move forward one character. |
152 | ||
153 | <DEL> or <Backspace> | |
154 | Delete the character to the left of the cursor. | |
155 | ||
84041b4c | 156 | `C-d' |
f9267e15 EZ |
157 | Delete the character underneath the cursor. |
158 | ||
159 | Printing characters | |
160 | Insert the character into the line at the cursor. | |
161 | ||
84041b4c | 162 | `C-_' or `C-x C-u' |
f9267e15 EZ |
163 | Undo the last editing command. You can undo all the way back to an |
164 | empty line. | |
165 | ||
166 | (Depending on your configuration, the <Backspace> key be set to delete | |
167 | the character to the left of the cursor and the <DEL> key set to delete | |
84041b4c | 168 | the character underneath the cursor, like `C-d', rather than the |
f9267e15 EZ |
169 | character to the left of the cursor.) |
170 | ||
171 | \1f | |
172 | File: rluserman.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction | |
173 | ||
174 | Readline Movement Commands | |
175 | -------------------------- | |
176 | ||
177 | The above table describes the most basic keystrokes that you need in | |
178 | order to do editing of the input line. For your convenience, many | |
84041b4c | 179 | other commands have been added in addition to `C-b', `C-f', `C-d', and |
f9267e15 EZ |
180 | <DEL>. Here are some commands for moving more rapidly about the line. |
181 | ||
84041b4c | 182 | `C-a' |
f9267e15 EZ |
183 | Move to the start of the line. |
184 | ||
84041b4c | 185 | `C-e' |
f9267e15 EZ |
186 | Move to the end of the line. |
187 | ||
84041b4c | 188 | `M-f' |
f9267e15 EZ |
189 | Move forward a word, where a word is composed of letters and |
190 | digits. | |
191 | ||
84041b4c | 192 | `M-b' |
f9267e15 EZ |
193 | Move backward a word. |
194 | ||
84041b4c | 195 | `C-l' |
f9267e15 EZ |
196 | Clear the screen, reprinting the current line at the top. |
197 | ||
84041b4c | 198 | Notice how `C-f' moves forward a character, while `M-f' moves |
f9267e15 EZ |
199 | forward a word. It is a loose convention that control keystrokes |
200 | operate on characters while meta keystrokes operate on words. | |
201 | ||
202 | \1f | |
203 | File: rluserman.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction | |
204 | ||
205 | Readline Killing Commands | |
206 | ------------------------- | |
207 | ||
208 | "Killing" text means to delete the text from the line, but to save | |
209 | it away for later use, usually by "yanking" (re-inserting) it back into | |
210 | the line. (`Cut' and `paste' are more recent jargon for `kill' and | |
211 | `yank'.) | |
212 | ||
213 | If the description for a command says that it `kills' text, then you | |
214 | can be sure that you can get the text back in a different (or the same) | |
215 | place later. | |
216 | ||
217 | When you use a kill command, the text is saved in a "kill-ring". | |
218 | Any number of consecutive kills save all of the killed text together, so | |
219 | that when you yank it back, you get it all. The kill ring is not line | |
220 | specific; the text that you killed on a previously typed line is | |
221 | available to be yanked back later, when you are typing another line. | |
222 | ||
223 | Here is the list of commands for killing text. | |
224 | ||
84041b4c | 225 | `C-k' |
f9267e15 EZ |
226 | Kill the text from the current cursor position to the end of the |
227 | line. | |
228 | ||
84041b4c | 229 | `M-d' |
f9267e15 EZ |
230 | Kill from the cursor to the end of the current word, or, if between |
231 | words, to the end of the next word. Word boundaries are the same | |
84041b4c | 232 | as those used by `M-f'. |
f9267e15 | 233 | |
84041b4c EZ |
234 | `M-<DEL>' |
235 | Kill from the cursor the start of the current word, or, if between | |
f9267e15 | 236 | words, to the start of the previous word. Word boundaries are the |
84041b4c | 237 | same as those used by `M-b'. |
f9267e15 | 238 | |
84041b4c | 239 | `C-w' |
f9267e15 | 240 | Kill from the cursor to the previous whitespace. This is |
84041b4c | 241 | different than `M-<DEL>' because the word boundaries differ. |
f9267e15 EZ |
242 | |
243 | Here is how to "yank" the text back into the line. Yanking means to | |
244 | copy the most-recently-killed text from the kill buffer. | |
245 | ||
84041b4c | 246 | `C-y' |
f9267e15 EZ |
247 | Yank the most recently killed text back into the buffer at the |
248 | cursor. | |
249 | ||
84041b4c | 250 | `M-y' |
f9267e15 | 251 | Rotate the kill-ring, and yank the new top. You can only do this |
84041b4c | 252 | if the prior command is `C-y' or `M-y'. |
f9267e15 EZ |
253 | |
254 | \1f | |
255 | File: rluserman.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction | |
256 | ||
257 | Readline Arguments | |
258 | ------------------ | |
259 | ||
260 | You can pass numeric arguments to Readline commands. Sometimes the | |
261 | argument acts as a repeat count, other times it is the sign of the | |
262 | argument that is significant. If you pass a negative argument to a | |
263 | command which normally acts in a forward direction, that command will | |
264 | act in a backward direction. For example, to kill text back to the | |
265 | start of the line, you might type `M-- C-k'. | |
266 | ||
267 | The general way to pass numeric arguments to a command is to type | |
268 | meta digits before the command. If the first `digit' typed is a minus | |
269 | sign (`-'), then the sign of the argument will be negative. Once you | |
270 | have typed one meta digit to get the argument started, you can type the | |
271 | remainder of the digits, and then the command. For example, to give | |
84041b4c EZ |
272 | the `C-d' command an argument of 10, you could type `M-1 0 C-d', which |
273 | will delete the next ten characters on the input line. | |
f9267e15 EZ |
274 | |
275 | \1f | |
276 | File: rluserman.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction | |
277 | ||
278 | Searching for Commands in the History | |
279 | ------------------------------------- | |
280 | ||
281 | Readline provides commands for searching through the command history | |
282 | for lines containing a specified string. There are two search modes: | |
84041b4c | 283 | "incremental" and "non-incremental". |
f9267e15 EZ |
284 | |
285 | Incremental searches begin before the user has finished typing the | |
286 | search string. As each character of the search string is typed, | |
287 | Readline displays the next entry from the history matching the string | |
288 | typed so far. An incremental search requires only as many characters | |
289 | as needed to find the desired history entry. To search backward in the | |
84041b4c | 290 | history for a particular string, type `C-r'. Typing `C-s' searches |
f9267e15 EZ |
291 | forward through the history. The characters present in the value of |
292 | the `isearch-terminators' variable are used to terminate an incremental | |
293 | search. If that variable has not been assigned a value, the <ESC> and | |
84041b4c | 294 | `C-J' characters will terminate an incremental search. `C-g' will |
f9267e15 EZ |
295 | abort an incremental search and restore the original line. When the |
296 | search is terminated, the history entry containing the search string | |
297 | becomes the current line. | |
298 | ||
84041b4c EZ |
299 | To find other matching entries in the history list, type `C-r' or |
300 | `C-s' as appropriate. This will search backward or forward in the | |
f9267e15 EZ |
301 | history for the next entry matching the search string typed so far. |
302 | Any other key sequence bound to a Readline command will terminate the | |
303 | search and execute that command. For instance, a <RET> will terminate | |
304 | the search and accept the line, thereby executing the command from the | |
84041b4c EZ |
305 | history list. A movement command will terminate the search, make the |
306 | last line found the current line, and begin editing. | |
307 | ||
308 | Readline remembers the last incremental search string. If two | |
309 | `C-r's are typed without any intervening characters defining a new | |
310 | search string, any remembered search string is used. | |
f9267e15 EZ |
311 | |
312 | Non-incremental searches read the entire search string before | |
313 | starting to search for matching history lines. The search string may be | |
314 | typed by the user or be part of the contents of the current line. | |
315 | ||
316 | \1f | |
317 | File: rluserman.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing | |
318 | ||
319 | Readline Init File | |
320 | ================== | |
321 | ||
322 | Although the Readline library comes with a set of Emacs-like | |
323 | keybindings installed by default, it is possible to use a different set | |
324 | of keybindings. Any user can customize programs that use Readline by | |
325 | putting commands in an "inputrc" file, conventionally in his home | |
326 | directory. The name of this file is taken from the value of the | |
327 | environment variable `INPUTRC'. If that variable is unset, the default | |
328 | is `~/.inputrc'. | |
329 | ||
330 | When a program which uses the Readline library starts up, the init | |
331 | file is read, and the key bindings are set. | |
332 | ||
333 | In addition, the `C-x C-r' command re-reads this init file, thus | |
334 | incorporating any changes that you might have made to it. | |
335 | ||
336 | * Menu: | |
337 | ||
338 | * Readline Init File Syntax:: Syntax for the commands in the inputrc file. | |
339 | ||
340 | * Conditional Init Constructs:: Conditional key bindings in the inputrc file. | |
341 | ||
342 | * Sample Init File:: An example inputrc file. | |
343 | ||
344 | \1f | |
345 | File: rluserman.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File | |
346 | ||
347 | Readline Init File Syntax | |
348 | ------------------------- | |
349 | ||
350 | There are only a few basic constructs allowed in the Readline init | |
351 | file. Blank lines are ignored. Lines beginning with a `#' are | |
352 | comments. Lines beginning with a `$' indicate conditional constructs | |
84041b4c | 353 | (*note Conditional Init Constructs::). Other lines denote variable |
f9267e15 EZ |
354 | settings and key bindings. |
355 | ||
356 | Variable Settings | |
357 | You can modify the run-time behavior of Readline by altering the | |
358 | values of variables in Readline using the `set' command within the | |
84041b4c EZ |
359 | init file. The syntax is simple: |
360 | ||
361 | set VARIABLE VALUE | |
362 | ||
363 | Here, for example, is how to change from the default Emacs-like | |
364 | key binding to use `vi' line editing commands: | |
f9267e15 EZ |
365 | |
366 | set editing-mode vi | |
367 | ||
84041b4c EZ |
368 | Variable names and values, where appropriate, are recognized |
369 | without regard to case. | |
370 | ||
f9267e15 EZ |
371 | A great deal of run-time behavior is changeable with the following |
372 | variables. | |
373 | ||
374 | `bell-style' | |
375 | Controls what happens when Readline wants to ring the | |
376 | terminal bell. If set to `none', Readline never rings the | |
377 | bell. If set to `visible', Readline uses a visible bell if | |
378 | one is available. If set to `audible' (the default), | |
379 | Readline attempts to ring the terminal's bell. | |
380 | ||
381 | `comment-begin' | |
382 | The string to insert at the beginning of the line when the | |
383 | `insert-comment' command is executed. The default value is | |
384 | `"#"'. | |
385 | ||
386 | `completion-ignore-case' | |
387 | If set to `on', Readline performs filename matching and | |
388 | completion in a case-insensitive fashion. The default value | |
389 | is `off'. | |
390 | ||
391 | `completion-query-items' | |
392 | The number of possible completions that determines when the | |
393 | user is asked whether he wants to see the list of | |
394 | possibilities. If the number of possible completions is | |
395 | greater than this value, Readline will ask the user whether | |
396 | or not he wishes to view them; otherwise, they are simply | |
84041b4c EZ |
397 | listed. This variable must be set to an integer value |
398 | greater than or equal to 0. The default limit is `100'. | |
f9267e15 EZ |
399 | |
400 | `convert-meta' | |
401 | If set to `on', Readline will convert characters with the | |
402 | eighth bit set to an ASCII key sequence by stripping the | |
403 | eighth bit and prefixing an <ESC> character, converting them | |
404 | to a meta-prefixed key sequence. The default value is `on'. | |
405 | ||
406 | `disable-completion' | |
407 | If set to `On', Readline will inhibit word completion. | |
408 | Completion characters will be inserted into the line as if | |
409 | they had been mapped to `self-insert'. The default is `off'. | |
410 | ||
411 | `editing-mode' | |
412 | The `editing-mode' variable controls which default set of key | |
413 | bindings is used. By default, Readline starts up in Emacs | |
414 | editing mode, where the keystrokes are most similar to Emacs. | |
415 | This variable can be set to either `emacs' or `vi'. | |
416 | ||
417 | `enable-keypad' | |
418 | When set to `on', Readline will try to enable the application | |
419 | keypad when it is called. Some systems need this to enable | |
420 | the arrow keys. The default is `off'. | |
421 | ||
422 | `expand-tilde' | |
423 | If set to `on', tilde expansion is performed when Readline | |
424 | attempts word completion. The default is `off'. | |
425 | ||
84041b4c EZ |
426 | If set to `on', the history code attempts to place point at |
427 | the same location on each history line retrived with | |
428 | `previous-history' or `next-history'. | |
429 | ||
f9267e15 EZ |
430 | `horizontal-scroll-mode' |
431 | This variable can be set to either `on' or `off'. Setting it | |
432 | to `on' means that the text of the lines being edited will | |
433 | scroll horizontally on a single screen line when they are | |
434 | longer than the width of the screen, instead of wrapping onto | |
435 | a new screen line. By default, this variable is set to `off'. | |
436 | ||
437 | `input-meta' | |
438 | If set to `on', Readline will enable eight-bit input (it will | |
84041b4c | 439 | not clear the eighth bit in the characters it reads), |
f9267e15 EZ |
440 | regardless of what the terminal claims it can support. The |
441 | default value is `off'. The name `meta-flag' is a synonym | |
442 | for this variable. | |
443 | ||
444 | `isearch-terminators' | |
445 | The string of characters that should terminate an incremental | |
446 | search without subsequently executing the character as a | |
84041b4c EZ |
447 | command (*note Searching::). If this variable has not been |
448 | given a value, the characters <ESC> and `C-J' will terminate | |
f9267e15 EZ |
449 | an incremental search. |
450 | ||
451 | `keymap' | |
452 | Sets Readline's idea of the current keymap for key binding | |
453 | commands. Acceptable `keymap' names are `emacs', | |
84041b4c | 454 | `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move', |
f9267e15 EZ |
455 | `vi-command', and `vi-insert'. `vi' is equivalent to |
456 | `vi-command'; `emacs' is equivalent to `emacs-standard'. The | |
457 | default value is `emacs'. The value of the `editing-mode' | |
458 | variable also affects the default keymap. | |
459 | ||
460 | `mark-directories' | |
461 | If set to `on', completed directory names have a slash | |
462 | appended. The default is `on'. | |
463 | ||
464 | `mark-modified-lines' | |
465 | This variable, when set to `on', causes Readline to display an | |
466 | asterisk (`*') at the start of history lines which have been | |
467 | modified. This variable is `off' by default. | |
468 | ||
84041b4c EZ |
469 | `mark-symlinked-directories' |
470 | If set to `on', completed names which are symbolic links to | |
471 | directories have a slash appended (subject to the value of | |
472 | `mark-directories'). The default is `off'. | |
473 | ||
474 | `match-hidden-files' | |
475 | This variable, when set to `on', causes Readline to match | |
476 | files whose names begin with a `.' (hidden files) when | |
477 | performing filename completion, unless the leading `.' is | |
478 | supplied by the user in the filename to be completed. This | |
479 | variable is `on' by default. | |
480 | ||
f9267e15 EZ |
481 | `output-meta' |
482 | If set to `on', Readline will display characters with the | |
483 | eighth bit set directly rather than as a meta-prefixed escape | |
484 | sequence. The default is `off'. | |
485 | ||
84041b4c EZ |
486 | `page-completions' |
487 | If set to `on', Readline uses an internal `more'-like pager | |
488 | to display a screenful of possible completions at a time. | |
489 | This variable is `on' by default. | |
490 | ||
f9267e15 EZ |
491 | `print-completions-horizontally' |
492 | If set to `on', Readline will display completions with matches | |
493 | sorted horizontally in alphabetical order, rather than down | |
494 | the screen. The default is `off'. | |
495 | ||
496 | `show-all-if-ambiguous' | |
497 | This alters the default behavior of the completion functions. | |
498 | If set to `on', words which have more than one possible | |
499 | completion cause the matches to be listed immediately instead | |
500 | of ringing the bell. The default value is `off'. | |
501 | ||
502 | `visible-stats' | |
503 | If set to `on', a character denoting a file's type is | |
504 | appended to the filename when listing possible completions. | |
505 | The default is `off'. | |
506 | ||
507 | Key Bindings | |
508 | The syntax for controlling key bindings in the init file is | |
509 | simple. First you need to find the name of the command that you | |
510 | want to change. The following sections contain tables of the | |
511 | command name, the default keybinding, if any, and a short | |
512 | description of what the command does. | |
513 | ||
84041b4c EZ |
514 | Once you know the name of the command, simply place on a line in |
515 | the init file the name of the key you wish to bind the command to, | |
516 | a colon, and then the name of the command. The name of the key | |
517 | can be expressed in different ways, depending on what you find most | |
518 | comfortable. | |
519 | ||
520 | In addition to command names, readline allows keys to be bound to | |
521 | a string that is inserted when the key is pressed (a MACRO). | |
f9267e15 EZ |
522 | |
523 | KEYNAME: FUNCTION-NAME or MACRO | |
524 | KEYNAME is the name of a key spelled out in English. For | |
525 | example: | |
526 | Control-u: universal-argument | |
527 | Meta-Rubout: backward-kill-word | |
528 | Control-o: "> output" | |
529 | ||
84041b4c EZ |
530 | In the above example, `C-u' is bound to the function |
531 | `universal-argument', `M-DEL' is bound to the function | |
532 | `backward-kill-word', and `C-o' is bound to run the macro | |
f9267e15 EZ |
533 | expressed on the right hand side (that is, to insert the text |
534 | `> output' into the line). | |
535 | ||
84041b4c EZ |
536 | A number of symbolic character names are recognized while |
537 | processing this key binding syntax: DEL, ESC, ESCAPE, LFD, | |
538 | NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB. | |
539 | ||
f9267e15 EZ |
540 | "KEYSEQ": FUNCTION-NAME or MACRO |
541 | KEYSEQ differs from KEYNAME above in that strings denoting an | |
542 | entire key sequence can be specified, by placing the key | |
543 | sequence in double quotes. Some GNU Emacs style key escapes | |
544 | can be used, as in the following example, but the special | |
545 | character names are not recognized. | |
546 | ||
547 | "\C-u": universal-argument | |
548 | "\C-x\C-r": re-read-init-file | |
549 | "\e[11~": "Function Key 1" | |
550 | ||
84041b4c | 551 | In the above example, `C-u' is again bound to the function |
f9267e15 | 552 | `universal-argument' (just as it was in the first example), |
84041b4c EZ |
553 | `C-x C-r' is bound to the function `re-read-init-file', and |
554 | `<ESC> <[> <1> <1> <~>' is bound to insert the text `Function | |
555 | Key 1'. | |
f9267e15 EZ |
556 | |
557 | The following GNU Emacs style escape sequences are available when | |
558 | specifying key sequences: | |
559 | ||
560 | `\C-' | |
561 | control prefix | |
562 | ||
563 | `\M-' | |
564 | meta prefix | |
565 | ||
566 | `\e' | |
567 | an escape character | |
568 | ||
569 | `\\' | |
570 | backslash | |
571 | ||
572 | `\"' | |
573 | <">, a double quotation mark | |
574 | ||
575 | `\'' | |
576 | <'>, a single quote or apostrophe | |
577 | ||
578 | In addition to the GNU Emacs style escape sequences, a second set | |
579 | of backslash escapes is available: | |
580 | ||
581 | `\a' | |
582 | alert (bell) | |
583 | ||
584 | `\b' | |
585 | backspace | |
586 | ||
587 | `\d' | |
588 | delete | |
589 | ||
590 | `\f' | |
591 | form feed | |
592 | ||
593 | `\n' | |
594 | newline | |
595 | ||
596 | `\r' | |
597 | carriage return | |
598 | ||
599 | `\t' | |
600 | horizontal tab | |
601 | ||
602 | `\v' | |
603 | vertical tab | |
604 | ||
605 | `\NNN' | |
84041b4c | 606 | the eight-bit character whose value is the octal value NNN |
f9267e15 EZ |
607 | (one to three digits) |
608 | ||
84041b4c EZ |
609 | `\xHH' |
610 | the eight-bit character whose value is the hexadecimal value | |
611 | HH (one or two hex digits) | |
612 | ||
f9267e15 EZ |
613 | When entering the text of a macro, single or double quotes must be |
614 | used to indicate a macro definition. Unquoted text is assumed to | |
615 | be a function name. In the macro body, the backslash escapes | |
616 | described above are expanded. Backslash will quote any other | |
617 | character in the macro text, including `"' and `''. For example, | |
618 | the following binding will make `C-x \' insert a single `\' into | |
619 | the line: | |
620 | "\C-x\\": "\\" | |
621 | ||
622 | \1f | |
623 | File: rluserman.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File | |
624 | ||
625 | Conditional Init Constructs | |
626 | --------------------------- | |
627 | ||
628 | Readline implements a facility similar in spirit to the conditional | |
629 | compilation features of the C preprocessor which allows key bindings | |
630 | and variable settings to be performed as the result of tests. There | |
631 | are four parser directives used. | |
632 | ||
633 | `$if' | |
634 | The `$if' construct allows bindings to be made based on the | |
635 | editing mode, the terminal being used, or the application using | |
636 | Readline. The text of the test extends to the end of the line; no | |
637 | characters are required to isolate it. | |
638 | ||
639 | `mode' | |
640 | The `mode=' form of the `$if' directive is used to test | |
641 | whether Readline is in `emacs' or `vi' mode. This may be | |
642 | used in conjunction with the `set keymap' command, for | |
643 | instance, to set bindings in the `emacs-standard' and | |
644 | `emacs-ctlx' keymaps only if Readline is starting out in | |
645 | `emacs' mode. | |
646 | ||
647 | `term' | |
648 | The `term=' form may be used to include terminal-specific key | |
649 | bindings, perhaps to bind the key sequences output by the | |
650 | terminal's function keys. The word on the right side of the | |
651 | `=' is tested against both the full name of the terminal and | |
652 | the portion of the terminal name before the first `-'. This | |
653 | allows `sun' to match both `sun' and `sun-cmd', for instance. | |
654 | ||
655 | `application' | |
656 | The APPLICATION construct is used to include | |
657 | application-specific settings. Each program using the | |
658 | Readline library sets the APPLICATION NAME, and you can test | |
84041b4c EZ |
659 | for a particular value. This could be used to bind key |
660 | sequences to functions useful for a specific program. For | |
661 | instance, the following command adds a key sequence that | |
662 | quotes the current or previous word in Bash: | |
f9267e15 EZ |
663 | $if Bash |
664 | # Quote the current or previous word | |
665 | "\C-xq": "\eb\"\ef\"" | |
666 | $endif | |
667 | ||
668 | `$endif' | |
669 | This command, as seen in the previous example, terminates an `$if' | |
670 | command. | |
671 | ||
672 | `$else' | |
673 | Commands in this branch of the `$if' directive are executed if the | |
674 | test fails. | |
675 | ||
676 | `$include' | |
677 | This directive takes a single filename as an argument and reads | |
84041b4c EZ |
678 | commands and bindings from that file. For example, the following |
679 | directive reads from `/etc/inputrc': | |
f9267e15 EZ |
680 | $include /etc/inputrc |
681 | ||
682 | \1f | |
683 | File: rluserman.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File | |
684 | ||
685 | Sample Init File | |
686 | ---------------- | |
687 | ||
84041b4c | 688 | Here is an example of an INPUTRC file. This illustrates key |
f9267e15 EZ |
689 | binding, variable assignment, and conditional syntax. |
690 | ||
691 | ||
692 | # This file controls the behaviour of line input editing for | |
84041b4c EZ |
693 | # programs that use the GNU Readline library. Existing |
694 | # programs include FTP, Bash, and GDB. | |
f9267e15 EZ |
695 | # |
696 | # You can re-read the inputrc file with C-x C-r. | |
697 | # Lines beginning with '#' are comments. | |
698 | # | |
84041b4c EZ |
699 | # First, include any systemwide bindings and variable |
700 | # assignments from /etc/Inputrc | |
f9267e15 EZ |
701 | $include /etc/Inputrc |
702 | ||
703 | # | |
704 | # Set various bindings for emacs mode. | |
705 | ||
706 | set editing-mode emacs | |
707 | ||
708 | $if mode=emacs | |
709 | ||
710 | Meta-Control-h: backward-kill-word Text after the function name is ignored | |
711 | ||
712 | # | |
713 | # Arrow keys in keypad mode | |
714 | # | |
715 | #"\M-OD": backward-char | |
716 | #"\M-OC": forward-char | |
717 | #"\M-OA": previous-history | |
718 | #"\M-OB": next-history | |
719 | # | |
720 | # Arrow keys in ANSI mode | |
721 | # | |
722 | "\M-[D": backward-char | |
723 | "\M-[C": forward-char | |
724 | "\M-[A": previous-history | |
725 | "\M-[B": next-history | |
726 | # | |
727 | # Arrow keys in 8 bit keypad mode | |
728 | # | |
729 | #"\M-\C-OD": backward-char | |
730 | #"\M-\C-OC": forward-char | |
731 | #"\M-\C-OA": previous-history | |
732 | #"\M-\C-OB": next-history | |
733 | # | |
734 | # Arrow keys in 8 bit ANSI mode | |
735 | # | |
736 | #"\M-\C-[D": backward-char | |
737 | #"\M-\C-[C": forward-char | |
738 | #"\M-\C-[A": previous-history | |
739 | #"\M-\C-[B": next-history | |
740 | ||
741 | C-q: quoted-insert | |
742 | ||
743 | $endif | |
744 | ||
745 | # An old-style binding. This happens to be the default. | |
746 | TAB: complete | |
747 | ||
748 | # Macros that are convenient for shell interaction | |
749 | $if Bash | |
750 | # edit the path | |
751 | "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f" | |
84041b4c EZ |
752 | # prepare to type a quoted word -- |
753 | # insert open and close double quotes | |
f9267e15 EZ |
754 | # and move to just after the open quote |
755 | "\C-x\"": "\"\"\C-b" | |
84041b4c EZ |
756 | # insert a backslash (testing backslash escapes |
757 | # in sequences and macros) | |
f9267e15 EZ |
758 | "\C-x\\": "\\" |
759 | # Quote the current or previous word | |
760 | "\C-xq": "\eb\"\ef\"" | |
761 | # Add a binding to refresh the line, which is unbound | |
762 | "\C-xr": redraw-current-line | |
763 | # Edit variable on current line. | |
764 | "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y=" | |
765 | $endif | |
766 | ||
767 | # use a visible bell if one is available | |
768 | set bell-style visible | |
769 | ||
770 | # don't strip characters to 7 bits when reading | |
771 | set input-meta on | |
772 | ||
84041b4c EZ |
773 | # allow iso-latin1 characters to be inserted rather |
774 | # than converted to prefix-meta sequences | |
f9267e15 EZ |
775 | set convert-meta off |
776 | ||
84041b4c EZ |
777 | # display characters with the eighth bit set directly |
778 | # rather than as meta-prefixed characters | |
f9267e15 EZ |
779 | set output-meta on |
780 | ||
84041b4c EZ |
781 | # if there are more than 150 possible completions for |
782 | # a word, ask the user if he wants to see all of them | |
f9267e15 EZ |
783 | set completion-query-items 150 |
784 | ||
785 | # For FTP | |
786 | $if Ftp | |
787 | "\C-xg": "get \M-?" | |
788 | "\C-xt": "put \M-?" | |
789 | "\M-.": yank-last-arg | |
790 | $endif | |
791 | ||
792 | \1f | |
793 | File: rluserman.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing | |
794 | ||
795 | Bindable Readline Commands | |
796 | ========================== | |
797 | ||
798 | * Menu: | |
799 | ||
800 | * Commands For Moving:: Moving about the line. | |
801 | * Commands For History:: Getting at previous lines. | |
802 | * Commands For Text:: Commands for changing text. | |
803 | * Commands For Killing:: Commands for killing and yanking. | |
804 | * Numeric Arguments:: Specifying numeric arguments, repeat counts. | |
805 | * Commands For Completion:: Getting Readline to do the typing for you. | |
806 | * Keyboard Macros:: Saving and re-executing typed characters | |
807 | * Miscellaneous Commands:: Other miscellaneous commands. | |
808 | ||
809 | This section describes Readline commands that may be bound to key | |
84041b4c EZ |
810 | sequences. Command names without an accompanying key sequence are |
811 | unbound by default. | |
f9267e15 | 812 | |
84041b4c EZ |
813 | In the following descriptions, "point" refers to the current cursor |
814 | position, and "mark" refers to a cursor position saved by the | |
f9267e15 | 815 | `set-mark' command. The text between the point and mark is referred to |
84041b4c | 816 | as the "region". |
f9267e15 EZ |
817 | |
818 | \1f | |
819 | File: rluserman.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands | |
820 | ||
821 | Commands For Moving | |
822 | ------------------- | |
823 | ||
824 | `beginning-of-line (C-a)' | |
825 | Move to the start of the current line. | |
826 | ||
827 | `end-of-line (C-e)' | |
828 | Move to the end of the line. | |
829 | ||
830 | `forward-char (C-f)' | |
831 | Move forward a character. | |
832 | ||
833 | `backward-char (C-b)' | |
834 | Move back a character. | |
835 | ||
836 | `forward-word (M-f)' | |
837 | Move forward to the end of the next word. Words are composed of | |
838 | letters and digits. | |
839 | ||
840 | `backward-word (M-b)' | |
841 | Move back to the start of the current or previous word. Words are | |
842 | composed of letters and digits. | |
843 | ||
844 | `clear-screen (C-l)' | |
845 | Clear the screen and redraw the current line, leaving the current | |
846 | line at the top of the screen. | |
847 | ||
848 | `redraw-current-line ()' | |
849 | Refresh the current line. By default, this is unbound. | |
850 | ||
851 | \1f | |
852 | File: rluserman.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands | |
853 | ||
854 | Commands For Manipulating The History | |
855 | ------------------------------------- | |
856 | ||
84041b4c | 857 | `accept-line (Newline or Return)' |
f9267e15 | 858 | Accept the line regardless of where the cursor is. If this line is |
84041b4c EZ |
859 | non-empty, it may be added to the history list for future recall |
860 | with `add_history()'. If this line is a modified history line, | |
861 | the history line is restored to its original state. | |
f9267e15 EZ |
862 | |
863 | `previous-history (C-p)' | |
84041b4c EZ |
864 | Move `back' through the history list, fetching the previous |
865 | command. | |
f9267e15 EZ |
866 | |
867 | `next-history (C-n)' | |
84041b4c | 868 | Move `forward' through the history list, fetching the next command. |
f9267e15 EZ |
869 | |
870 | `beginning-of-history (M-<)' | |
871 | Move to the first line in the history. | |
872 | ||
873 | `end-of-history (M->)' | |
874 | Move to the end of the input history, i.e., the line currently | |
875 | being entered. | |
876 | ||
877 | `reverse-search-history (C-r)' | |
878 | Search backward starting at the current line and moving `up' | |
879 | through the history as necessary. This is an incremental search. | |
880 | ||
881 | `forward-search-history (C-s)' | |
882 | Search forward starting at the current line and moving `down' | |
883 | through the the history as necessary. This is an incremental | |
884 | search. | |
885 | ||
886 | `non-incremental-reverse-search-history (M-p)' | |
887 | Search backward starting at the current line and moving `up' | |
888 | through the history as necessary using a non-incremental search | |
889 | for a string supplied by the user. | |
890 | ||
891 | `non-incremental-forward-search-history (M-n)' | |
892 | Search forward starting at the current line and moving `down' | |
893 | through the the history as necessary using a non-incremental search | |
894 | for a string supplied by the user. | |
895 | ||
896 | `history-search-forward ()' | |
897 | Search forward through the history for the string of characters | |
898 | between the start of the current line and the point. This is a | |
899 | non-incremental search. By default, this command is unbound. | |
900 | ||
901 | `history-search-backward ()' | |
902 | Search backward through the history for the string of characters | |
903 | between the start of the current line and the point. This is a | |
904 | non-incremental search. By default, this command is unbound. | |
905 | ||
906 | `yank-nth-arg (M-C-y)' | |
907 | Insert the first argument to the previous command (usually the | |
84041b4c EZ |
908 | second word on the previous line) at point. With an argument N, |
909 | insert the Nth word from the previous command (the words in the | |
910 | previous command begin with word 0). A negative argument inserts | |
911 | the Nth word from the end of the previous command. | |
f9267e15 | 912 | |
84041b4c | 913 | `yank-last-arg (M-. or M-_)' |
f9267e15 EZ |
914 | Insert last argument to the previous command (the last word of the |
915 | previous history entry). With an argument, behave exactly like | |
916 | `yank-nth-arg'. Successive calls to `yank-last-arg' move back | |
917 | through the history list, inserting the last argument of each line | |
918 | in turn. | |
919 | ||
920 | \1f | |
921 | File: rluserman.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands | |
922 | ||
923 | Commands For Changing Text | |
924 | -------------------------- | |
925 | ||
926 | `delete-char (C-d)' | |
84041b4c EZ |
927 | Delete the character at point. If point is at the beginning of |
928 | the line, there are no characters in the line, and the last | |
929 | character typed was not bound to `delete-char', then return EOF. | |
f9267e15 EZ |
930 | |
931 | `backward-delete-char (Rubout)' | |
932 | Delete the character behind the cursor. A numeric argument means | |
933 | to kill the characters instead of deleting them. | |
934 | ||
935 | `forward-backward-delete-char ()' | |
936 | Delete the character under the cursor, unless the cursor is at the | |
937 | end of the line, in which case the character behind the cursor is | |
938 | deleted. By default, this is not bound to a key. | |
939 | ||
84041b4c | 940 | `quoted-insert (C-q or C-v)' |
f9267e15 | 941 | Add the next character typed to the line verbatim. This is how to |
84041b4c | 942 | insert key sequences like `C-q', for example. |
f9267e15 | 943 | |
84041b4c | 944 | `tab-insert (M-<TAB>)' |
f9267e15 EZ |
945 | Insert a tab character. |
946 | ||
947 | `self-insert (a, b, A, 1, !, ...)' | |
948 | Insert yourself. | |
949 | ||
950 | `transpose-chars (C-t)' | |
951 | Drag the character before the cursor forward over the character at | |
952 | the cursor, moving the cursor forward as well. If the insertion | |
953 | point is at the end of the line, then this transposes the last two | |
954 | characters of the line. Negative arguments have no effect. | |
955 | ||
956 | `transpose-words (M-t)' | |
957 | Drag the word before point past the word after point, moving point | |
84041b4c EZ |
958 | past that word as well. If the insertion point is at the end of |
959 | the line, this transposes the last two words on the line. | |
f9267e15 EZ |
960 | |
961 | `upcase-word (M-u)' | |
962 | Uppercase the current (or following) word. With a negative | |
963 | argument, uppercase the previous word, but do not move the cursor. | |
964 | ||
965 | `downcase-word (M-l)' | |
966 | Lowercase the current (or following) word. With a negative | |
967 | argument, lowercase the previous word, but do not move the cursor. | |
968 | ||
969 | `capitalize-word (M-c)' | |
970 | Capitalize the current (or following) word. With a negative | |
971 | argument, capitalize the previous word, but do not move the cursor. | |
972 | ||
84041b4c EZ |
973 | `overwrite-mode ()' |
974 | Toggle overwrite mode. With an explicit positive numeric argument, | |
975 | switches to overwrite mode. With an explicit non-positive numeric | |
976 | argument, switches to insert mode. This command affects only | |
977 | `emacs' mode; `vi' mode does overwrite differently. Each call to | |
978 | `readline()' starts in insert mode. | |
979 | ||
980 | In overwrite mode, characters bound to `self-insert' replace the | |
981 | text at point rather than pushing the text to the right. | |
982 | Characters bound to `backward-delete-char' replace the character | |
983 | before point with a space. | |
984 | ||
985 | By default, this command is unbound. | |
986 | ||
f9267e15 EZ |
987 | \1f |
988 | File: rluserman.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands | |
989 | ||
990 | Killing And Yanking | |
991 | ------------------- | |
992 | ||
993 | `kill-line (C-k)' | |
994 | Kill the text from point to the end of the line. | |
995 | ||
996 | `backward-kill-line (C-x Rubout)' | |
997 | Kill backward to the beginning of the line. | |
998 | ||
999 | `unix-line-discard (C-u)' | |
1000 | Kill backward from the cursor to the beginning of the current line. | |
1001 | ||
1002 | `kill-whole-line ()' | |
84041b4c EZ |
1003 | Kill all characters on the current line, no matter where point is. |
1004 | By default, this is unbound. | |
f9267e15 EZ |
1005 | |
1006 | `kill-word (M-d)' | |
1007 | Kill from point to the end of the current word, or if between | |
1008 | words, to the end of the next word. Word boundaries are the same | |
1009 | as `forward-word'. | |
1010 | ||
84041b4c | 1011 | `backward-kill-word (M-<DEL>)' |
f9267e15 EZ |
1012 | Kill the word behind point. Word boundaries are the same as |
1013 | `backward-word'. | |
1014 | ||
1015 | `unix-word-rubout (C-w)' | |
1016 | Kill the word behind point, using white space as a word boundary. | |
1017 | The killed text is saved on the kill-ring. | |
1018 | ||
1019 | `delete-horizontal-space ()' | |
1020 | Delete all spaces and tabs around point. By default, this is | |
1021 | unbound. | |
1022 | ||
1023 | `kill-region ()' | |
1024 | Kill the text in the current region. By default, this command is | |
1025 | unbound. | |
1026 | ||
1027 | `copy-region-as-kill ()' | |
1028 | Copy the text in the region to the kill buffer, so it can be yanked | |
1029 | right away. By default, this command is unbound. | |
1030 | ||
1031 | `copy-backward-word ()' | |
1032 | Copy the word before point to the kill buffer. The word | |
1033 | boundaries are the same as `backward-word'. By default, this | |
1034 | command is unbound. | |
1035 | ||
1036 | `copy-forward-word ()' | |
1037 | Copy the word following point to the kill buffer. The word | |
1038 | boundaries are the same as `forward-word'. By default, this | |
1039 | command is unbound. | |
1040 | ||
1041 | `yank (C-y)' | |
84041b4c | 1042 | Yank the top of the kill ring into the buffer at point. |
f9267e15 EZ |
1043 | |
1044 | `yank-pop (M-y)' | |
1045 | Rotate the kill-ring, and yank the new top. You can only do this | |
84041b4c | 1046 | if the prior command is `yank' or `yank-pop'. |
f9267e15 EZ |
1047 | |
1048 | \1f | |
1049 | File: rluserman.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands | |
1050 | ||
1051 | Specifying Numeric Arguments | |
1052 | ---------------------------- | |
1053 | ||
1054 | `digit-argument (M-0, M-1, ... M--)' | |
1055 | Add this digit to the argument already accumulating, or start a new | |
84041b4c | 1056 | argument. `M--' starts a negative argument. |
f9267e15 EZ |
1057 | |
1058 | `universal-argument ()' | |
1059 | This is another way to specify an argument. If this command is | |
1060 | followed by one or more digits, optionally with a leading minus | |
1061 | sign, those digits define the argument. If the command is | |
1062 | followed by digits, executing `universal-argument' again ends the | |
1063 | numeric argument, but is otherwise ignored. As a special case, if | |
1064 | this command is immediately followed by a character that is | |
1065 | neither a digit or minus sign, the argument count for the next | |
1066 | command is multiplied by four. The argument count is initially | |
1067 | one, so executing this function the first time makes the argument | |
1068 | count four, a second time makes the argument count sixteen, and so | |
1069 | on. By default, this is not bound to a key. | |
1070 | ||
1071 | \1f | |
1072 | File: rluserman.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands | |
1073 | ||
1074 | Letting Readline Type For You | |
1075 | ----------------------------- | |
1076 | ||
84041b4c EZ |
1077 | `complete (<TAB>)' |
1078 | Attempt to perform completion on the text before point. The | |
1079 | actual completion performed is application-specific. The default | |
1080 | is filename completion. | |
f9267e15 EZ |
1081 | |
1082 | `possible-completions (M-?)' | |
84041b4c | 1083 | List the possible completions of the text before point. |
f9267e15 EZ |
1084 | |
1085 | `insert-completions (M-*)' | |
1086 | Insert all completions of the text before point that would have | |
1087 | been generated by `possible-completions'. | |
1088 | ||
1089 | `menu-complete ()' | |
1090 | Similar to `complete', but replaces the word to be completed with | |
1091 | a single match from the list of possible completions. Repeated | |
1092 | execution of `menu-complete' steps through the list of possible | |
1093 | completions, inserting each match in turn. At the end of the list | |
84041b4c EZ |
1094 | of completions, the bell is rung (subject to the setting of |
1095 | `bell-style') and the original text is restored. An argument of N | |
1096 | moves N positions forward in the list of matches; a negative | |
1097 | argument may be used to move backward through the list. This | |
1098 | command is intended to be bound to <TAB>, but is unbound by | |
f9267e15 EZ |
1099 | default. |
1100 | ||
1101 | `delete-char-or-list ()' | |
1102 | Deletes the character under the cursor if not at the beginning or | |
1103 | end of the line (like `delete-char'). If at the end of the line, | |
1104 | behaves identically to `possible-completions'. This command is | |
1105 | unbound by default. | |
1106 | ||
1107 | \1f | |
1108 | File: rluserman.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands | |
1109 | ||
1110 | Keyboard Macros | |
1111 | --------------- | |
1112 | ||
1113 | `start-kbd-macro (C-x ()' | |
1114 | Begin saving the characters typed into the current keyboard macro. | |
1115 | ||
1116 | `end-kbd-macro (C-x ))' | |
1117 | Stop saving the characters typed into the current keyboard macro | |
1118 | and save the definition. | |
1119 | ||
1120 | `call-last-kbd-macro (C-x e)' | |
1121 | Re-execute the last keyboard macro defined, by making the | |
1122 | characters in the macro appear as if typed at the keyboard. | |
1123 | ||
1124 | \1f | |
1125 | File: rluserman.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands | |
1126 | ||
1127 | Some Miscellaneous Commands | |
1128 | --------------------------- | |
1129 | ||
1130 | `re-read-init-file (C-x C-r)' | |
1131 | Read in the contents of the INPUTRC file, and incorporate any | |
1132 | bindings or variable assignments found there. | |
1133 | ||
1134 | `abort (C-g)' | |
1135 | Abort the current editing command and ring the terminal's bell | |
1136 | (subject to the setting of `bell-style'). | |
1137 | ||
1138 | `do-uppercase-version (M-a, M-b, M-X, ...)' | |
1139 | If the metafied character X is lowercase, run the command that is | |
1140 | bound to the corresponding uppercase character. | |
1141 | ||
84041b4c EZ |
1142 | `prefix-meta (<ESC>)' |
1143 | Metafy the next character typed. This is for keyboards without a | |
1144 | meta key. Typing `<ESC> f' is equivalent to typing `M-f'. | |
f9267e15 | 1145 | |
84041b4c | 1146 | `undo (C-_ or C-x C-u)' |
f9267e15 EZ |
1147 | Incremental undo, separately remembered for each line. |
1148 | ||
1149 | `revert-line (M-r)' | |
1150 | Undo all changes made to this line. This is like executing the | |
1151 | `undo' command enough times to get back to the beginning. | |
1152 | ||
1153 | `tilde-expand (M-~)' | |
1154 | Perform tilde expansion on the current word. | |
1155 | ||
1156 | `set-mark (C-@)' | |
84041b4c EZ |
1157 | Set the mark to the point. If a numeric argument is supplied, the |
1158 | mark is set to that position. | |
f9267e15 EZ |
1159 | |
1160 | `exchange-point-and-mark (C-x C-x)' | |
1161 | Swap the point with the mark. The current cursor position is set | |
1162 | to the saved position, and the old cursor position is saved as the | |
1163 | mark. | |
1164 | ||
1165 | `character-search (C-])' | |
1166 | A character is read and point is moved to the next occurrence of | |
1167 | that character. A negative count searches for previous | |
1168 | occurrences. | |
1169 | ||
1170 | `character-search-backward (M-C-])' | |
1171 | A character is read and point is moved to the previous occurrence | |
1172 | of that character. A negative count searches for subsequent | |
1173 | occurrences. | |
1174 | ||
1175 | `insert-comment (M-#)' | |
84041b4c EZ |
1176 | Without a numeric argument, the value of the `comment-begin' |
1177 | variable is inserted at the beginning of the current line. If a | |
1178 | numeric argument is supplied, this command acts as a toggle: if | |
1179 | the characters at the beginning of the line do not match the value | |
1180 | of `comment-begin', the value is inserted, otherwise the | |
1181 | characters in `comment-begin' are deleted from the beginning of | |
1182 | the line. In either case, the line is accepted as if a newline | |
1183 | had been typed. | |
f9267e15 EZ |
1184 | |
1185 | `dump-functions ()' | |
1186 | Print all of the functions and their key bindings to the Readline | |
1187 | output stream. If a numeric argument is supplied, the output is | |
1188 | formatted in such a way that it can be made part of an INPUTRC | |
1189 | file. This command is unbound by default. | |
1190 | ||
1191 | `dump-variables ()' | |
1192 | Print all of the settable variables and their values to the | |
1193 | Readline output stream. If a numeric argument is supplied, the | |
1194 | output is formatted in such a way that it can be made part of an | |
1195 | INPUTRC file. This command is unbound by default. | |
1196 | ||
1197 | `dump-macros ()' | |
1198 | Print all of the Readline key sequences bound to macros and the | |
84041b4c EZ |
1199 | strings they output. If a numeric argument is supplied, the |
1200 | output is formatted in such a way that it can be made part of an | |
1201 | INPUTRC file. This command is unbound by default. | |
1202 | ||
1203 | `emacs-editing-mode (C-e)' | |
1204 | When in `vi' command mode, this causes a switch to `emacs' editing | |
1205 | mode. | |
1206 | ||
1207 | `vi-editing-mode (M-C-j)' | |
1208 | When in `emacs' editing mode, this causes a switch to `vi' editing | |
1209 | mode. | |
f9267e15 EZ |
1210 | |
1211 | \1f | |
1212 | File: rluserman.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing | |
1213 | ||
1214 | Readline vi Mode | |
1215 | ================ | |
1216 | ||
1217 | While the Readline library does not have a full set of `vi' editing | |
1218 | functions, it does contain enough to allow simple editing of the line. | |
1219 | The Readline `vi' mode behaves as specified in the POSIX 1003.2 | |
1220 | standard. | |
1221 | ||
1222 | In order to switch interactively between `emacs' and `vi' editing | |
84041b4c EZ |
1223 | modes, use the command `M-C-j' (bound to emacs-editing-mode when in |
1224 | `vi' mode and to vi-editing-mode in `emacs' mode). The Readline | |
f9267e15 EZ |
1225 | default is `emacs' mode. |
1226 | ||
1227 | When you enter a line in `vi' mode, you are already placed in | |
1228 | `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches | |
1229 | you into `command' mode, where you can edit the text of the line with | |
1230 | the standard `vi' movement keys, move to previous history lines with | |
1231 | `k' and subsequent lines with `j', and so forth. | |
1232 | ||
1233 | ||
1234 | \1f | |
1235 | Tag Table: | |
84041b4c EZ |
1236 | Node: Top\7f1208 |
1237 | Node: Command Line Editing\7f1604 | |
1238 | Node: Introduction and Notation\7f2218 | |
1239 | Node: Readline Interaction\7f3837 | |
1240 | Node: Readline Bare Essentials\7f5025 | |
1241 | Node: Readline Movement Commands\7f6807 | |
1242 | Node: Readline Killing Commands\7f7765 | |
1243 | Node: Readline Arguments\7f9675 | |
1244 | Node: Searching\7f10712 | |
1245 | Node: Readline Init File\7f12856 | |
1246 | Node: Readline Init File Syntax\7f13918 | |
1247 | Node: Conditional Init Constructs\7f24802 | |
1248 | Node: Sample Init File\7f27328 | |
1249 | Node: Bindable Readline Commands\7f30513 | |
1250 | Node: Commands For Moving\7f31564 | |
1251 | Node: Commands For History\7f32414 | |
1252 | Node: Commands For Text\7f35273 | |
1253 | Node: Commands For Killing\7f37988 | |
1254 | Node: Numeric Arguments\7f39940 | |
1255 | Node: Commands For Completion\7f41069 | |
1256 | Node: Keyboard Macros\7f42602 | |
1257 | Node: Miscellaneous Commands\7f43162 | |
1258 | Node: Readline vi Mode\7f46512 | |
f9267e15 EZ |
1259 | \1f |
1260 | End Tag Table |