b813dda6c1e746bdbc123a849c7a66dccac508ec
[deliverable/binutils-gdb.git] / readline / doc / rluserman.html
1 <HTML>
2 <HEAD>
3 <!-- This HTML file has been created by texi2html 1.52
4 from /usr/homes/chet/src/bash/readline-src/doc/rluserman.texinfo on 1 March 2000 -->
5
6 <TITLE>GNU Readline Library</TITLE>
7 </HEAD>
8 <BODY>
9 <H1>GNU Readline Library User Interface</H1>
10 <H2>Edition 4.1, for <CODE>Readline Library</CODE> Version 4.1.</H2>
11 <H2>January 2000</H2>
12 <ADDRESS>Brian Fox, Free Software Foundation</ADDRESS>
13 <ADDRESS>Chet Ramey, Case Western Reserve University</ADDRESS>
14 <P>
15 <P><HR><P>
16 <H1>Table of Contents</H1>
17 <UL>
18 <LI><A NAME="TOC1" HREF="rluserman.html#SEC1">Command Line Editing</A>
19 <UL>
20 <LI><A NAME="TOC2" HREF="rluserman.html#SEC2">Introduction to Line Editing</A>
21 <LI><A NAME="TOC3" HREF="rluserman.html#SEC3">Readline Interaction</A>
22 <UL>
23 <LI><A NAME="TOC4" HREF="rluserman.html#SEC4">Readline Bare Essentials</A>
24 <LI><A NAME="TOC5" HREF="rluserman.html#SEC5">Readline Movement Commands</A>
25 <LI><A NAME="TOC6" HREF="rluserman.html#SEC6">Readline Killing Commands</A>
26 <LI><A NAME="TOC7" HREF="rluserman.html#SEC7">Readline Arguments</A>
27 <LI><A NAME="TOC8" HREF="rluserman.html#SEC8">Searching for Commands in the History</A>
28 </UL>
29 <LI><A NAME="TOC9" HREF="rluserman.html#SEC9">Readline Init File</A>
30 <UL>
31 <LI><A NAME="TOC10" HREF="rluserman.html#SEC10">Readline Init File Syntax</A>
32 <LI><A NAME="TOC11" HREF="rluserman.html#SEC11">Conditional Init Constructs</A>
33 <LI><A NAME="TOC12" HREF="rluserman.html#SEC12">Sample Init File</A>
34 </UL>
35 <LI><A NAME="TOC13" HREF="rluserman.html#SEC13">Bindable Readline Commands</A>
36 <UL>
37 <LI><A NAME="TOC14" HREF="rluserman.html#SEC14">Commands For Moving</A>
38 <LI><A NAME="TOC15" HREF="rluserman.html#SEC15">Commands For Manipulating The History</A>
39 <LI><A NAME="TOC16" HREF="rluserman.html#SEC16">Commands For Changing Text</A>
40 <LI><A NAME="TOC17" HREF="rluserman.html#SEC17">Killing And Yanking</A>
41 <LI><A NAME="TOC18" HREF="rluserman.html#SEC18">Specifying Numeric Arguments</A>
42 <LI><A NAME="TOC19" HREF="rluserman.html#SEC19">Letting Readline Type For You</A>
43 <LI><A NAME="TOC20" HREF="rluserman.html#SEC20">Keyboard Macros</A>
44 <LI><A NAME="TOC21" HREF="rluserman.html#SEC21">Some Miscellaneous Commands</A>
45 </UL>
46 <LI><A NAME="TOC22" HREF="rluserman.html#SEC22">Readline vi Mode</A>
47 </UL>
48 </UL>
49 <P><HR><P>
50
51 <P>
52 This document describes the end user interface of the GNU Readline Library,
53 a utility which aids in the consistency of user interface across discrete
54 programs that need to provide a command line interface.
55
56 </P>
57 <P>
58 Published by the Free Software Foundation <BR>
59 59 Temple Place, Suite 330, <BR>
60 Boston, MA 02111 USA
61
62 </P>
63 <P>
64 Permission is granted to make and distribute verbatim copies of
65 this manual provided the copyright notice and this permission notice
66 are preserved on all copies.
67
68 </P>
69 <P>
70 Permission is granted to copy and distribute modified versions of this
71 manual under the conditions for verbatim copying, provided that the entire
72 resulting derived work is distributed under the terms of a permission
73 notice identical to this one.
74
75 </P>
76 <P>
77 Permission is granted to copy and distribute translations of this manual
78 into another language, under the above conditions for modified versions,
79 except that this permission notice may be stated in a translation approved
80 by the Free Software Foundation.
81
82 </P>
83 <P>
84 Copyright (C) 1988-1999 Free Software Foundation, Inc.
85
86 </P>
87
88
89
90 <H1><A NAME="SEC1" HREF="rluserman.html#TOC1">Command Line Editing</A></H1>
91
92 <P>
93 This chapter describes the basic features of the GNU
94 command line editing interface.
95
96 </P>
97
98 <UL>
99 <LI><A HREF="rluserman.html#SEC2">Introduction and Notation</A>: Notation used in this text.
100 <LI><A HREF="rluserman.html#SEC3">Readline Interaction</A>: The minimum set of commands for editing a line.
101 <LI><A HREF="rluserman.html#SEC9">Readline Init File</A>: Customizing Readline from a user's view.
102 <LI><A HREF="rluserman.html#SEC13">Bindable Readline Commands</A>: A description of most of the Readline commands
103 available for binding
104 <LI><A HREF="rluserman.html#SEC22">Readline vi Mode</A>: A short description of how to make Readline
105 behave like the vi editor.
106 </UL>
107
108
109
110 <H2><A NAME="SEC2" HREF="rluserman.html#TOC2">Introduction to Line Editing</A></H2>
111
112 <P>
113 The following paragraphs describe the notation used to represent
114 keystrokes.
115
116 </P>
117 <P>
118 The text <KBD>C-k</KBD> is read as `Control-K' and describes the character
119 produced when the <KBD>k</KBD> key is pressed while the Control key
120 is depressed.
121
122 </P>
123 <P>
124 The text <KBD>M-k</KBD> is read as `Meta-K' and describes the character
125 produced when the Meta key (if you have one) is depressed, and the <KBD>k</KBD>
126 key is pressed.
127 The Meta key is labeled <KBD>ALT</KBD> on many keyboards.
128 On keyboards with two keys labeled <KBD>ALT</KBD> (usually to either side of
129 the space bar), the <KBD>ALT</KBD> on the left side is generally set to
130 work as a Meta key.
131 The <KBD>ALT</KBD> key on the right may also be configured to work as a
132 Meta key or may be configured as some other modifier, such as a
133 Compose key for typing accented characters.
134
135 </P>
136 <P>
137 If you do not have a Meta or <KBD>ALT</KBD> key, or another key working as
138 a Meta key, the identical keystroke can be generated by typing <KBD>ESC</KBD>
139 <I>first</I>, and then typing <KBD>k</KBD>.
140 Either process is known as <EM>metafying</EM> the <KBD>k</KBD> key.
141
142 </P>
143 <P>
144 The text <KBD>M-C-k</KBD> is read as `Meta-Control-k' and describes the
145 character produced by <EM>metafying</EM> <KBD>C-k</KBD>.
146
147 </P>
148 <P>
149 In addition, several keys have their own names. Specifically,
150 <KBD>DEL</KBD>, <KBD>ESC</KBD>, <KBD>LFD</KBD>, <KBD>SPC</KBD>, <KBD>RET</KBD>, and <KBD>TAB</KBD> all
151 stand for themselves when seen in this text, or in an init file
152 (see section <A HREF="rluserman.html#SEC9">Readline Init File</A>).
153 If your keyboard lacks a <KBD>LFD</KBD> key, typing <KBD>C-j</KBD> will
154 produce the desired character.
155 The <KBD>RET</KBD> key may be labeled <KBD>Return</KBD> or <KBD>Enter</KBD> on
156 some keyboards.
157
158 </P>
159
160
161 <H2><A NAME="SEC3" HREF="rluserman.html#TOC3">Readline Interaction</A></H2>
162 <P>
163 <A NAME="IDX1"></A>
164
165 </P>
166 <P>
167 Often during an interactive session you type in a long line of text,
168 only to notice that the first word on the line is misspelled. The
169 Readline library gives you a set of commands for manipulating the text
170 as you type it in, allowing you to just fix your typo, and not forcing
171 you to retype the majority of the line. Using these editing commands,
172 you move the cursor to the place that needs correction, and delete or
173 insert the text of the corrections. Then, when you are satisfied with
174 the line, you simply press <KBD>RETURN</KBD>. You do not have to be at the
175 end of the line to press <KBD>RETURN</KBD>; the entire line is accepted
176 regardless of the location of the cursor within the line.
177
178 </P>
179
180 <UL>
181 <LI><A HREF="rluserman.html#SEC4">Readline Bare Essentials</A>: The least you need to know about Readline.
182 <LI><A HREF="rluserman.html#SEC5">Readline Movement Commands</A>: Moving about the input line.
183 <LI><A HREF="rluserman.html#SEC6">Readline Killing Commands</A>: How to delete text, and how to get it back!
184 <LI><A HREF="rluserman.html#SEC7">Readline Arguments</A>: Giving numeric arguments to commands.
185 <LI><A HREF="rluserman.html#SEC8">Searching</A>: Searching through previous lines.
186 </UL>
187
188
189
190 <H3><A NAME="SEC4" HREF="rluserman.html#TOC4">Readline Bare Essentials</A></H3>
191 <P>
192 <A NAME="IDX2"></A>
193 <A NAME="IDX3"></A>
194 <A NAME="IDX4"></A>
195
196 </P>
197 <P>
198 In order to enter characters into the line, simply type them. The typed
199 character appears where the cursor was, and then the cursor moves one
200 space to the right. If you mistype a character, you can use your
201 erase character to back up and delete the mistyped character.
202
203 </P>
204 <P>
205 Sometimes you may mistype a character, and
206 not notice the error until you have typed several other characters. In
207 that case, you can type <KBD>C-b</KBD> to move the cursor to the left, and then
208 correct your mistake. Afterwards, you can move the cursor to the right
209 with <KBD>C-f</KBD>.
210
211 </P>
212 <P>
213 When you add text in the middle of a line, you will notice that characters
214 to the right of the cursor are `pushed over' to make room for the text
215 that you have inserted. Likewise, when you delete text behind the cursor,
216 characters to the right of the cursor are `pulled back' to fill in the
217 blank space created by the removal of the text. A list of the bare
218 essentials for editing the text of an input line follows.
219
220 </P>
221 <DL COMPACT>
222
223 <DT><KBD>C-b</KBD>
224 <DD>
225 Move back one character.
226 <DT><KBD>C-f</KBD>
227 <DD>
228 Move forward one character.
229 <DT><KBD>DEL</KBD> or <KBD>Backspace</KBD>
230 <DD>
231 Delete the character to the left of the cursor.
232 <DT><KBD>C-d</KBD>
233 <DD>
234 Delete the character underneath the cursor.
235 <DT>Printing characters
236 <DD>
237 Insert the character into the line at the cursor.
238 <DT><KBD>C-_</KBD> or <KBD>C-x C-u</KBD>
239 <DD>
240 Undo the last editing command. You can undo all the way back to an
241 empty line.
242 </DL>
243
244 <P>
245 (Depending on your configuration, the <KBD>Backspace</KBD> key be set to
246 delete the character to the left of the cursor and the <KBD>DEL</KBD> key set
247 to delete the character underneath the cursor, like <KBD>C-d</KBD>, rather
248 than the character to the left of the cursor.)
249
250 </P>
251
252
253 <H3><A NAME="SEC5" HREF="rluserman.html#TOC5">Readline Movement Commands</A></H3>
254
255 <P>
256 The above table describes the most basic keystrokes that you need
257 in order to do editing of the input line. For your convenience, many
258 other commands have been added in addition to <KBD>C-b</KBD>, <KBD>C-f</KBD>,
259 <KBD>C-d</KBD>, and <KBD>DEL</KBD>. Here are some commands for moving more rapidly
260 about the line.
261
262 </P>
263 <DL COMPACT>
264
265 <DT><KBD>C-a</KBD>
266 <DD>
267 Move to the start of the line.
268 <DT><KBD>C-e</KBD>
269 <DD>
270 Move to the end of the line.
271 <DT><KBD>M-f</KBD>
272 <DD>
273 Move forward a word, where a word is composed of letters and digits.
274 <DT><KBD>M-b</KBD>
275 <DD>
276 Move backward a word.
277 <DT><KBD>C-l</KBD>
278 <DD>
279 Clear the screen, reprinting the current line at the top.
280 </DL>
281
282 <P>
283 Notice how <KBD>C-f</KBD> moves forward a character, while <KBD>M-f</KBD> moves
284 forward a word. It is a loose convention that control keystrokes
285 operate on characters while meta keystrokes operate on words.
286
287 </P>
288
289
290 <H3><A NAME="SEC6" HREF="rluserman.html#TOC6">Readline Killing Commands</A></H3>
291
292 <P>
293 <A NAME="IDX5"></A>
294 <A NAME="IDX6"></A>
295
296 </P>
297 <P>
298 <EM>Killing</EM> text means to delete the text from the line, but to save
299 it away for later use, usually by <EM>yanking</EM> (re-inserting)
300 it back into the line.
301 (`Cut' and `paste' are more recent jargon for `kill' and `yank'.)
302
303 </P>
304 <P>
305 If the description for a command says that it `kills' text, then you can
306 be sure that you can get the text back in a different (or the same)
307 place later.
308
309 </P>
310 <P>
311 When you use a kill command, the text is saved in a <EM>kill-ring</EM>.
312 Any number of consecutive kills save all of the killed text together, so
313 that when you yank it back, you get it all. The kill
314 ring is not line specific; the text that you killed on a previously
315 typed line is available to be yanked back later, when you are typing
316 another line.
317 <A NAME="IDX7"></A>
318
319 </P>
320 <P>
321 Here is the list of commands for killing text.
322
323 </P>
324 <DL COMPACT>
325
326 <DT><KBD>C-k</KBD>
327 <DD>
328 Kill the text from the current cursor position to the end of the line.
329
330 <DT><KBD>M-d</KBD>
331 <DD>
332 Kill from the cursor to the end of the current word, or, if between
333 words, to the end of the next word.
334 Word boundaries are the same as those used by <KBD>M-f</KBD>.
335
336 <DT><KBD>M-DEL</KBD>
337 <DD>
338 Kill from the cursor the start of the previous word, or, if between
339 words, to the start of the previous word.
340 Word boundaries are the same as those used by <KBD>M-b</KBD>.
341
342 <DT><KBD>C-w</KBD>
343 <DD>
344 Kill from the cursor to the previous whitespace. This is different than
345 <KBD>M-DEL</KBD> because the word boundaries differ.
346
347 </DL>
348
349 <P>
350 Here is how to <EM>yank</EM> the text back into the line. Yanking
351 means to copy the most-recently-killed text from the kill buffer.
352
353 </P>
354 <DL COMPACT>
355
356 <DT><KBD>C-y</KBD>
357 <DD>
358 Yank the most recently killed text back into the buffer at the cursor.
359
360 <DT><KBD>M-y</KBD>
361 <DD>
362 Rotate the kill-ring, and yank the new top. You can only do this if
363 the prior command is <KBD>C-y</KBD> or <KBD>M-y</KBD>.
364 </DL>
365
366
367
368 <H3><A NAME="SEC7" HREF="rluserman.html#TOC7">Readline Arguments</A></H3>
369
370 <P>
371 You can pass numeric arguments to Readline commands. Sometimes the
372 argument acts as a repeat count, other times it is the <I>sign</I> of the
373 argument that is significant. If you pass a negative argument to a
374 command which normally acts in a forward direction, that command will
375 act in a backward direction. For example, to kill text back to the
376 start of the line, you might type <SAMP>`M-- C-k'</SAMP>.
377
378 </P>
379 <P>
380 The general way to pass numeric arguments to a command is to type meta
381 digits before the command. If the first `digit' typed is a minus
382 sign (<SAMP>`-'</SAMP>), then the sign of the argument will be negative. Once
383 you have typed one meta digit to get the argument started, you can type
384 the remainder of the digits, and then the command. For example, to give
385 the <KBD>C-d</KBD> command an argument of 10, you could type <SAMP>`M-1 0 C-d'</SAMP>.
386
387 </P>
388
389
390 <H3><A NAME="SEC8" HREF="rluserman.html#TOC8">Searching for Commands in the History</A></H3>
391
392 <P>
393 Readline provides commands for searching through the command history
394 for lines containing a specified string.
395 There are two search modes: <VAR>incremental</VAR> and <VAR>non-incremental</VAR>.
396
397 </P>
398 <P>
399 Incremental searches begin before the user has finished typing the
400 search string.
401 As each character of the search string is typed, Readline displays
402 the next entry from the history matching the string typed so far.
403 An incremental search requires only as many characters as needed to
404 find the desired history entry.
405 To search backward in the history for a particular string, type
406 <KBD>C-r</KBD>. Typing <KBD>C-s</KBD> searches forward through the history.
407 The characters present in the value of the <CODE>isearch-terminators</CODE> variable
408 are used to terminate an incremental search.
409 If that variable has not been assigned a value, the <KBD>ESC</KBD> and
410 <KBD>C-J</KBD> characters will terminate an incremental search.
411 <KBD>C-g</KBD> will abort an incremental search and restore the original line.
412 When the search is terminated, the history entry containing the
413 search string becomes the current line.
414
415 </P>
416 <P>
417 To find other matching entries in the history list, type <KBD>C-r</KBD> or
418 <KBD>C-s</KBD> as appropriate.
419 This will search backward or forward in the history for the next
420 entry matching the search string typed so far.
421 Any other key sequence bound to a Readline command will terminate
422 the search and execute that command.
423 For instance, a <KBD>RET</KBD> will terminate the search and accept
424 the line, thereby executing the command from the history list.
425
426 </P>
427 <P>
428 Non-incremental searches read the entire search string before starting
429 to search for matching history lines. The search string may be
430 typed by the user or be part of the contents of the current line.
431
432 </P>
433
434
435 <H2><A NAME="SEC9" HREF="rluserman.html#TOC9">Readline Init File</A></H2>
436 <P>
437 <A NAME="IDX8"></A>
438
439 </P>
440 <P>
441 Although the Readline library comes with a set of Emacs-like
442 keybindings installed by default, it is possible to use a different set
443 of keybindings.
444 Any user can customize programs that use Readline by putting
445 commands in an <EM>inputrc</EM> file, conventionally in his home directory.
446 The name of this
447 file is taken from the value of the environment variable <CODE>INPUTRC</CODE>. If
448 that variable is unset, the default is <TT>`~/.inputrc'</TT>.
449
450 </P>
451 <P>
452 When a program which uses the Readline library starts up, the
453 init file is read, and the key bindings are set.
454
455 </P>
456 <P>
457 In addition, the <CODE>C-x C-r</CODE> command re-reads this init file, thus
458 incorporating any changes that you might have made to it.
459
460 </P>
461
462 <UL>
463 <LI><A HREF="rluserman.html#SEC10">Readline Init File Syntax</A>: Syntax for the commands in the inputrc file.
464
465 <LI><A HREF="rluserman.html#SEC11">Conditional Init Constructs</A>: Conditional key bindings in the inputrc file.
466
467 <LI><A HREF="rluserman.html#SEC12">Sample Init File</A>: An example inputrc file.
468 </UL>
469
470
471
472 <H3><A NAME="SEC10" HREF="rluserman.html#TOC10">Readline Init File Syntax</A></H3>
473
474 <P>
475 There are only a few basic constructs allowed in the
476 Readline init file. Blank lines are ignored.
477 Lines beginning with a <SAMP>`#'</SAMP> are comments.
478 Lines beginning with a <SAMP>`$'</SAMP> indicate conditional
479 constructs (see section <A HREF="rluserman.html#SEC11">Conditional Init Constructs</A>). Other lines
480 denote variable settings and key bindings.
481
482 </P>
483 <DL COMPACT>
484
485 <DT>Variable Settings
486 <DD>
487 You can modify the run-time behavior of Readline by
488 altering the values of variables in Readline
489 using the <CODE>set</CODE> command within the init file. Here is how to
490 change from the default Emacs-like key binding to use
491 <CODE>vi</CODE> line editing commands:
492
493
494 <PRE>
495 set editing-mode vi
496 </PRE>
497
498 A great deal of run-time behavior is changeable with the following
499 variables.
500
501 <DL COMPACT>
502
503 <DT><CODE>bell-style</CODE>
504 <DD>
505 <A NAME="IDX9"></A>
506 Controls what happens when Readline wants to ring the terminal bell.
507 If set to <SAMP>`none'</SAMP>, Readline never rings the bell. If set to
508 <SAMP>`visible'</SAMP>, Readline uses a visible bell if one is available.
509 If set to <SAMP>`audible'</SAMP> (the default), Readline attempts to ring
510 the terminal's bell.
511
512 <DT><CODE>comment-begin</CODE>
513 <DD>
514 <A NAME="IDX10"></A>
515 The string to insert at the beginning of the line when the
516 <CODE>insert-comment</CODE> command is executed. The default value
517 is <CODE>"#"</CODE>.
518
519 <DT><CODE>completion-ignore-case</CODE>
520 <DD>
521 If set to <SAMP>`on'</SAMP>, Readline performs filename matching and completion
522 in a case-insensitive fashion.
523 The default value is <SAMP>`off'</SAMP>.
524
525 <DT><CODE>completion-query-items</CODE>
526 <DD>
527 <A NAME="IDX11"></A>
528 The number of possible completions that determines when the user is
529 asked whether he wants to see the list of possibilities. If the
530 number of possible completions is greater than this value,
531 Readline will ask the user whether or not he wishes to view
532 them; otherwise, they are simply listed. The default limit is
533 <CODE>100</CODE>.
534
535 <DT><CODE>convert-meta</CODE>
536 <DD>
537 <A NAME="IDX12"></A>
538 If set to <SAMP>`on'</SAMP>, Readline will convert characters with the
539 eighth bit set to an ASCII key sequence by stripping the eighth
540 bit and prefixing an <KBD>ESC</KBD> character, converting them to a
541 meta-prefixed key sequence. The default value is <SAMP>`on'</SAMP>.
542
543 <DT><CODE>disable-completion</CODE>
544 <DD>
545 <A NAME="IDX13"></A>
546 If set to <SAMP>`On'</SAMP>, Readline will inhibit word completion.
547 Completion characters will be inserted into the line as if they had
548 been mapped to <CODE>self-insert</CODE>. The default is <SAMP>`off'</SAMP>.
549
550 <DT><CODE>editing-mode</CODE>
551 <DD>
552 <A NAME="IDX14"></A>
553 The <CODE>editing-mode</CODE> variable controls which default set of
554 key bindings is used. By default, Readline starts up in Emacs editing
555 mode, where the keystrokes are most similar to Emacs. This variable can be
556 set to either <SAMP>`emacs'</SAMP> or <SAMP>`vi'</SAMP>.
557
558 <DT><CODE>enable-keypad</CODE>
559 <DD>
560 <A NAME="IDX15"></A>
561 When set to <SAMP>`on'</SAMP>, Readline will try to enable the application
562 keypad when it is called. Some systems need this to enable the
563 arrow keys. The default is <SAMP>`off'</SAMP>.
564
565 <DT><CODE>expand-tilde</CODE>
566 <DD>
567 <A NAME="IDX16"></A>
568 If set to <SAMP>`on'</SAMP>, tilde expansion is performed when Readline
569 attempts word completion. The default is <SAMP>`off'</SAMP>.
570
571 <DT><CODE>horizontal-scroll-mode</CODE>
572 <DD>
573 <A NAME="IDX17"></A>
574 This variable can be set to either <SAMP>`on'</SAMP> or <SAMP>`off'</SAMP>. Setting it
575 to <SAMP>`on'</SAMP> means that the text of the lines being edited will scroll
576 horizontally on a single screen line when they are longer than the width
577 of the screen, instead of wrapping onto a new screen line. By default,
578 this variable is set to <SAMP>`off'</SAMP>.
579
580 <DT><CODE>input-meta</CODE>
581 <DD>
582 <A NAME="IDX18"></A>
583 <A NAME="IDX19"></A>
584 If set to <SAMP>`on'</SAMP>, Readline will enable eight-bit input (it
585 will not strip the eighth bit from the characters it reads),
586 regardless of what the terminal claims it can support. The
587 default value is <SAMP>`off'</SAMP>. The name <CODE>meta-flag</CODE> is a
588 synonym for this variable.
589
590 <DT><CODE>isearch-terminators</CODE>
591 <DD>
592 <A NAME="IDX20"></A>
593 The string of characters that should terminate an incremental search without
594 subsequently executing the character as a command (see section <A HREF="rluserman.html#SEC8">Searching for Commands in the History</A>).
595 If this variable has not been given a value, the characters <KBD>ESC</KBD> and
596 <KBD>C-J</KBD> will terminate an incremental search.
597
598 <DT><CODE>keymap</CODE>
599 <DD>
600 <A NAME="IDX21"></A>
601 Sets Readline's idea of the current keymap for key binding commands.
602 Acceptable <CODE>keymap</CODE> names are
603 <CODE>emacs</CODE>,
604 <CODE>emacs-standard</CODE>,
605 <CODE>emacs-meta</CODE>,
606 <CODE>emacs-ctlx</CODE>,
607 <CODE>vi</CODE>,
608 <CODE>vi-command</CODE>, and
609 <CODE>vi-insert</CODE>.
610 <CODE>vi</CODE> is equivalent to <CODE>vi-command</CODE>; <CODE>emacs</CODE> is
611 equivalent to <CODE>emacs-standard</CODE>. The default value is <CODE>emacs</CODE>.
612 The value of the <CODE>editing-mode</CODE> variable also affects the
613 default keymap.
614
615 <DT><CODE>mark-directories</CODE>
616 <DD>
617 If set to <SAMP>`on'</SAMP>, completed directory names have a slash
618 appended. The default is <SAMP>`on'</SAMP>.
619
620 <DT><CODE>mark-modified-lines</CODE>
621 <DD>
622 <A NAME="IDX22"></A>
623 This variable, when set to <SAMP>`on'</SAMP>, causes Readline to display an
624 asterisk (<SAMP>`*'</SAMP>) at the start of history lines which have been modified.
625 This variable is <SAMP>`off'</SAMP> by default.
626
627 <DT><CODE>output-meta</CODE>
628 <DD>
629 <A NAME="IDX23"></A>
630 If set to <SAMP>`on'</SAMP>, Readline will display characters with the
631 eighth bit set directly rather than as a meta-prefixed escape
632 sequence. The default is <SAMP>`off'</SAMP>.
633
634 <DT><CODE>print-completions-horizontally</CODE>
635 <DD>
636 If set to <SAMP>`on'</SAMP>, Readline will display completions with matches
637 sorted horizontally in alphabetical order, rather than down the screen.
638 The default is <SAMP>`off'</SAMP>.
639
640 <DT><CODE>show-all-if-ambiguous</CODE>
641 <DD>
642 <A NAME="IDX24"></A>
643 This alters the default behavior of the completion functions. If
644 set to <SAMP>`on'</SAMP>,
645 words which have more than one possible completion cause the
646 matches to be listed immediately instead of ringing the bell.
647 The default value is <SAMP>`off'</SAMP>.
648
649 <DT><CODE>visible-stats</CODE>
650 <DD>
651 <A NAME="IDX25"></A>
652 If set to <SAMP>`on'</SAMP>, a character denoting a file's type
653 is appended to the filename when listing possible
654 completions. The default is <SAMP>`off'</SAMP>.
655
656 </DL>
657
658 <DT>Key Bindings
659 <DD>
660 The syntax for controlling key bindings in the init file is
661 simple. First you need to find the name of the command that you
662 want to change. The following sections contain tables of the command
663 name, the default keybinding, if any, and a short description of what
664 the command does.
665
666 Once you know the name of the command, simply place the name of the key
667 you wish to bind the command to, a colon, and then the name of the
668 command on a line in the init file. The name of the key
669 can be expressed in different ways, depending on which is most
670 comfortable for you.
671
672 <DL COMPACT>
673
674 <DT><VAR>keyname</VAR>: <VAR>function-name</VAR> or <VAR>macro</VAR>
675 <DD>
676 <VAR>keyname</VAR> is the name of a key spelled out in English. For example:
677
678 <PRE>
679 Control-u: universal-argument
680 Meta-Rubout: backward-kill-word
681 Control-o: "&#62; output"
682 </PRE>
683
684 In the above example, <KBD>C-u</KBD> is bound to the function
685 <CODE>universal-argument</CODE>, and <KBD>C-o</KBD> is bound to run the macro
686 expressed on the right hand side (that is, to insert the text
687 <SAMP>`&#62; output'</SAMP> into the line).
688
689 <DT>"<VAR>keyseq</VAR>": <VAR>function-name</VAR> or <VAR>macro</VAR>
690 <DD>
691 <VAR>keyseq</VAR> differs from <VAR>keyname</VAR> above in that strings
692 denoting an entire key sequence can be specified, by placing
693 the key sequence in double quotes. Some GNU Emacs style key
694 escapes can be used, as in the following example, but the
695 special character names are not recognized.
696
697
698 <PRE>
699 "\C-u": universal-argument
700 "\C-x\C-r": re-read-init-file
701 "\e[11~": "Function Key 1"
702 </PRE>
703
704 In the above example, <KBD>C-u</KBD> is bound to the function
705 <CODE>universal-argument</CODE> (just as it was in the first example),
706 <SAMP>`<KBD>C-x</KBD> <KBD>C-r</KBD>'</SAMP> is bound to the function <CODE>re-read-init-file</CODE>,
707 and <SAMP>`<KBD>ESC</KBD> <KBD>[</KBD> <KBD>1</KBD> <KBD>1</KBD> <KBD>~</KBD>'</SAMP> is bound to insert
708 the text <SAMP>`Function Key 1'</SAMP>.
709
710 </DL>
711
712 The following GNU Emacs style escape sequences are available when
713 specifying key sequences:
714
715 <DL COMPACT>
716
717 <DT><CODE><KBD>\C-</KBD></CODE>
718 <DD>
719 control prefix
720 <DT><CODE><KBD>\M-</KBD></CODE>
721 <DD>
722 meta prefix
723 <DT><CODE><KBD>\e</KBD></CODE>
724 <DD>
725 an escape character
726 <DT><CODE><KBD>\\</KBD></CODE>
727 <DD>
728 backslash
729 <DT><CODE><KBD>\"</KBD></CODE>
730 <DD>
731 <KBD>"</KBD>, a double quotation mark
732 <DT><CODE><KBD>\'</KBD></CODE>
733 <DD>
734 <KBD>'</KBD>, a single quote or apostrophe
735 </DL>
736
737 In addition to the GNU Emacs style escape sequences, a second
738 set of backslash escapes is available:
739
740 <DL COMPACT>
741
742 <DT><CODE>\a</CODE>
743 <DD>
744 alert (bell)
745 <DT><CODE>\b</CODE>
746 <DD>
747 backspace
748 <DT><CODE>\d</CODE>
749 <DD>
750 delete
751 <DT><CODE>\f</CODE>
752 <DD>
753 form feed
754 <DT><CODE>\n</CODE>
755 <DD>
756 newline
757 <DT><CODE>\r</CODE>
758 <DD>
759 carriage return
760 <DT><CODE>\t</CODE>
761 <DD>
762 horizontal tab
763 <DT><CODE>\v</CODE>
764 <DD>
765 vertical tab
766 <DT><CODE>\<VAR>nnn</VAR></CODE>
767 <DD>
768 the character whose <CODE>ASCII</CODE> code is the octal value <VAR>nnn</VAR>
769 (one to three digits)
770 <DT><CODE>\x<VAR>nnn</VAR></CODE>
771 <DD>
772 the character whose <CODE>ASCII</CODE> code is the hexadecimal value <VAR>nnn</VAR>
773 (one to three digits)
774 </DL>
775
776 When entering the text of a macro, single or double quotes must
777 be used to indicate a macro definition.
778 Unquoted text is assumed to be a function name.
779 In the macro body, the backslash escapes described above are expanded.
780 Backslash will quote any other character in the macro text,
781 including <SAMP>`"'</SAMP> and <SAMP>`''</SAMP>.
782 For example, the following binding will make <SAMP>`C-x \'</SAMP>
783 insert a single <SAMP>`\'</SAMP> into the line:
784
785 <PRE>
786 "\C-x\\": "\\"
787 </PRE>
788
789 </DL>
790
791
792
793 <H3><A NAME="SEC11" HREF="rluserman.html#TOC11">Conditional Init Constructs</A></H3>
794
795 <P>
796 Readline implements a facility similar in spirit to the conditional
797 compilation features of the C preprocessor which allows key
798 bindings and variable settings to be performed as the result
799 of tests. There are four parser directives used.
800
801 </P>
802 <DL COMPACT>
803
804 <DT><CODE>$if</CODE>
805 <DD>
806 The <CODE>$if</CODE> construct allows bindings to be made based on the
807 editing mode, the terminal being used, or the application using
808 Readline. The text of the test extends to the end of the line;
809 no characters are required to isolate it.
810
811 <DL COMPACT>
812
813 <DT><CODE>mode</CODE>
814 <DD>
815 The <CODE>mode=</CODE> form of the <CODE>$if</CODE> directive is used to test
816 whether Readline is in <CODE>emacs</CODE> or <CODE>vi</CODE> mode.
817 This may be used in conjunction
818 with the <SAMP>`set keymap'</SAMP> command, for instance, to set bindings in
819 the <CODE>emacs-standard</CODE> and <CODE>emacs-ctlx</CODE> keymaps only if
820 Readline is starting out in <CODE>emacs</CODE> mode.
821
822 <DT><CODE>term</CODE>
823 <DD>
824 The <CODE>term=</CODE> form may be used to include terminal-specific
825 key bindings, perhaps to bind the key sequences output by the
826 terminal's function keys. The word on the right side of the
827 <SAMP>`='</SAMP> is tested against both the full name of the terminal and
828 the portion of the terminal name before the first <SAMP>`-'</SAMP>. This
829 allows <CODE>sun</CODE> to match both <CODE>sun</CODE> and <CODE>sun-cmd</CODE>,
830 for instance.
831
832 <DT><CODE>application</CODE>
833 <DD>
834 The <VAR>application</VAR> construct is used to include
835 application-specific settings. Each program using the Readline
836 library sets the <VAR>application name</VAR>, and you can test for it.
837 This could be used to bind key sequences to functions useful for
838 a specific program. For instance, the following command adds a
839 key sequence that quotes the current or previous word in Bash:
840
841 <PRE>
842 $if Bash
843 # Quote the current or previous word
844 "\C-xq": "\eb\"\ef\""
845 $endif
846 </PRE>
847
848 </DL>
849
850 <DT><CODE>$endif</CODE>
851 <DD>
852 This command, as seen in the previous example, terminates an
853 <CODE>$if</CODE> command.
854
855 <DT><CODE>$else</CODE>
856 <DD>
857 Commands in this branch of the <CODE>$if</CODE> directive are executed if
858 the test fails.
859
860 <DT><CODE>$include</CODE>
861 <DD>
862 This directive takes a single filename as an argument and reads commands
863 and bindings from that file.
864
865 <PRE>
866 $include /etc/inputrc
867 </PRE>
868
869 </DL>
870
871
872
873 <H3><A NAME="SEC12" HREF="rluserman.html#TOC12">Sample Init File</A></H3>
874
875 <P>
876 Here is an example of an inputrc file. This illustrates key
877 binding, variable assignment, and conditional syntax.
878
879 </P>
880
881 <PRE>
882 # This file controls the behaviour of line input editing for
883 # programs that use the Gnu Readline library. Existing programs
884 # include FTP, Bash, and Gdb.
885 #
886 # You can re-read the inputrc file with C-x C-r.
887 # Lines beginning with '#' are comments.
888 #
889 # First, include any systemwide bindings and variable assignments from
890 # /etc/Inputrc
891 $include /etc/Inputrc
892
893 #
894 # Set various bindings for emacs mode.
895
896 set editing-mode emacs
897
898 $if mode=emacs
899
900 Meta-Control-h: backward-kill-word Text after the function name is ignored
901
902 #
903 # Arrow keys in keypad mode
904 #
905 #"\M-OD": backward-char
906 #"\M-OC": forward-char
907 #"\M-OA": previous-history
908 #"\M-OB": next-history
909 #
910 # Arrow keys in ANSI mode
911 #
912 "\M-[D": backward-char
913 "\M-[C": forward-char
914 "\M-[A": previous-history
915 "\M-[B": next-history
916 #
917 # Arrow keys in 8 bit keypad mode
918 #
919 #"\M-\C-OD": backward-char
920 #"\M-\C-OC": forward-char
921 #"\M-\C-OA": previous-history
922 #"\M-\C-OB": next-history
923 #
924 # Arrow keys in 8 bit ANSI mode
925 #
926 #"\M-\C-[D": backward-char
927 #"\M-\C-[C": forward-char
928 #"\M-\C-[A": previous-history
929 #"\M-\C-[B": next-history
930
931 C-q: quoted-insert
932
933 $endif
934
935 # An old-style binding. This happens to be the default.
936 TAB: complete
937
938 # Macros that are convenient for shell interaction
939 $if Bash
940 # edit the path
941 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
942 # prepare to type a quoted word -- insert open and close double quotes
943 # and move to just after the open quote
944 "\C-x\"": "\"\"\C-b"
945 # insert a backslash (testing backslash escapes in sequences and macros)
946 "\C-x\\": "\\"
947 # Quote the current or previous word
948 "\C-xq": "\eb\"\ef\""
949 # Add a binding to refresh the line, which is unbound
950 "\C-xr": redraw-current-line
951 # Edit variable on current line.
952 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
953 $endif
954
955 # use a visible bell if one is available
956 set bell-style visible
957
958 # don't strip characters to 7 bits when reading
959 set input-meta on
960
961 # allow iso-latin1 characters to be inserted rather than converted to
962 # prefix-meta sequences
963 set convert-meta off
964
965 # display characters with the eighth bit set directly rather than
966 # as meta-prefixed characters
967 set output-meta on
968
969 # if there are more than 150 possible completions for a word, ask the
970 # user if he wants to see all of them
971 set completion-query-items 150
972
973 # For FTP
974 $if Ftp
975 "\C-xg": "get \M-?"
976 "\C-xt": "put \M-?"
977 "\M-.": yank-last-arg
978 $endif
979 </PRE>
980
981
982
983 <H2><A NAME="SEC13" HREF="rluserman.html#TOC13">Bindable Readline Commands</A></H2>
984
985
986 <UL>
987 <LI><A HREF="rluserman.html#SEC14">Commands For Moving</A>: Moving about the line.
988 <LI><A HREF="rluserman.html#SEC15">Commands For History</A>: Getting at previous lines.
989 <LI><A HREF="rluserman.html#SEC16">Commands For Text</A>: Commands for changing text.
990 <LI><A HREF="rluserman.html#SEC17">Commands For Killing</A>: Commands for killing and yanking.
991 <LI><A HREF="rluserman.html#SEC18">Numeric Arguments</A>: Specifying numeric arguments, repeat counts.
992 <LI><A HREF="rluserman.html#SEC19">Commands For Completion</A>: Getting Readline to do the typing for you.
993 <LI><A HREF="rluserman.html#SEC20">Keyboard Macros</A>: Saving and re-executing typed characters
994 <LI><A HREF="rluserman.html#SEC21">Miscellaneous Commands</A>: Other miscellaneous commands.
995 </UL>
996
997 <P>
998 This section describes Readline commands that may be bound to key
999 sequences.
1000
1001 </P>
1002 <P>
1003 Command names without an accompanying key sequence are unbound by default.
1004 In the following descriptions, <VAR>point</VAR> refers to the current cursor
1005 position, and <VAR>mark</VAR> refers to a cursor position saved by the
1006 <CODE>set-mark</CODE> command.
1007 The text between the point and mark is referred to as the <VAR>region</VAR>.
1008
1009 </P>
1010
1011
1012 <H3><A NAME="SEC14" HREF="rluserman.html#TOC14">Commands For Moving</A></H3>
1013 <DL COMPACT>
1014
1015 <DT><CODE>beginning-of-line (C-a)</CODE>
1016 <DD>
1017 <A NAME="IDX26"></A>
1018 Move to the start of the current line.
1019
1020 <DT><CODE>end-of-line (C-e)</CODE>
1021 <DD>
1022 <A NAME="IDX27"></A>
1023 Move to the end of the line.
1024
1025 <DT><CODE>forward-char (C-f)</CODE>
1026 <DD>
1027 <A NAME="IDX28"></A>
1028 Move forward a character.
1029
1030 <DT><CODE>backward-char (C-b)</CODE>
1031 <DD>
1032 <A NAME="IDX29"></A>
1033 Move back a character.
1034
1035 <DT><CODE>forward-word (M-f)</CODE>
1036 <DD>
1037 <A NAME="IDX30"></A>
1038 Move forward to the end of the next word. Words are composed of
1039 letters and digits.
1040
1041 <DT><CODE>backward-word (M-b)</CODE>
1042 <DD>
1043 <A NAME="IDX31"></A>
1044 Move back to the start of the current or previous word. Words are
1045 composed of letters and digits.
1046
1047 <DT><CODE>clear-screen (C-l)</CODE>
1048 <DD>
1049 <A NAME="IDX32"></A>
1050 Clear the screen and redraw the current line,
1051 leaving the current line at the top of the screen.
1052
1053 <DT><CODE>redraw-current-line ()</CODE>
1054 <DD>
1055 <A NAME="IDX33"></A>
1056 Refresh the current line. By default, this is unbound.
1057
1058 </DL>
1059
1060
1061
1062 <H3><A NAME="SEC15" HREF="rluserman.html#TOC15">Commands For Manipulating The History</A></H3>
1063
1064 <DL COMPACT>
1065
1066 <DT><CODE>accept-line (Newline, Return)</CODE>
1067 <DD>
1068 <A NAME="IDX34"></A>
1069 Accept the line regardless of where the cursor is. If this line is
1070 non-empty, add it to the history list. If this line was a history
1071 line, then restore the history line to its original state.
1072
1073 <DT><CODE>previous-history (C-p)</CODE>
1074 <DD>
1075 <A NAME="IDX35"></A>
1076 Move `up' through the history list.
1077
1078 <DT><CODE>next-history (C-n)</CODE>
1079 <DD>
1080 <A NAME="IDX36"></A>
1081 Move `down' through the history list.
1082
1083 <DT><CODE>beginning-of-history (M-&#60;)</CODE>
1084 <DD>
1085 <A NAME="IDX37"></A>
1086 Move to the first line in the history.
1087
1088 <DT><CODE>end-of-history (M-&#62;)</CODE>
1089 <DD>
1090 <A NAME="IDX38"></A>
1091 Move to the end of the input history, i.e., the line currently
1092 being entered.
1093
1094 <DT><CODE>reverse-search-history (C-r)</CODE>
1095 <DD>
1096 <A NAME="IDX39"></A>
1097 Search backward starting at the current line and moving `up' through
1098 the history as necessary. This is an incremental search.
1099
1100 <DT><CODE>forward-search-history (C-s)</CODE>
1101 <DD>
1102 <A NAME="IDX40"></A>
1103 Search forward starting at the current line and moving `down' through
1104 the the history as necessary. This is an incremental search.
1105
1106 <DT><CODE>non-incremental-reverse-search-history (M-p)</CODE>
1107 <DD>
1108 <A NAME="IDX41"></A>
1109 Search backward starting at the current line and moving `up'
1110 through the history as necessary using a non-incremental search
1111 for a string supplied by the user.
1112
1113 <DT><CODE>non-incremental-forward-search-history (M-n)</CODE>
1114 <DD>
1115 <A NAME="IDX42"></A>
1116 Search forward starting at the current line and moving `down'
1117 through the the history as necessary using a non-incremental search
1118 for a string supplied by the user.
1119
1120 <DT><CODE>history-search-forward ()</CODE>
1121 <DD>
1122 <A NAME="IDX43"></A>
1123 Search forward through the history for the string of characters
1124 between the start of the current line and the point.
1125 This is a non-incremental search.
1126 By default, this command is unbound.
1127
1128 <DT><CODE>history-search-backward ()</CODE>
1129 <DD>
1130 <A NAME="IDX44"></A>
1131 Search backward through the history for the string of characters
1132 between the start of the current line and the point. This
1133 is a non-incremental search. By default, this command is unbound.
1134
1135 <DT><CODE>yank-nth-arg (M-C-y)</CODE>
1136 <DD>
1137 <A NAME="IDX45"></A>
1138 Insert the first argument to the previous command (usually
1139 the second word on the previous line). With an argument <VAR>n</VAR>,
1140 insert the <VAR>n</VAR>th word from the previous command (the words
1141 in the previous command begin with word 0). A negative argument
1142 inserts the <VAR>n</VAR>th word from the end of the previous command.
1143
1144 <DT><CODE>yank-last-arg (M-., M-_)</CODE>
1145 <DD>
1146 <A NAME="IDX46"></A>
1147 Insert last argument to the previous command (the last word of the
1148 previous history entry). With an
1149 argument, behave exactly like <CODE>yank-nth-arg</CODE>.
1150 Successive calls to <CODE>yank-last-arg</CODE> move back through the history
1151 list, inserting the last argument of each line in turn.
1152
1153 </DL>
1154
1155
1156
1157 <H3><A NAME="SEC16" HREF="rluserman.html#TOC16">Commands For Changing Text</A></H3>
1158
1159 <DL COMPACT>
1160
1161 <DT><CODE>delete-char (C-d)</CODE>
1162 <DD>
1163 <A NAME="IDX47"></A>
1164 Delete the character under the cursor. If the cursor is at the
1165 beginning of the line, there are no characters in the line, and
1166 the last character typed was not bound to <CODE>delete-char</CODE>, then
1167 return <CODE>EOF</CODE>.
1168
1169 <DT><CODE>backward-delete-char (Rubout)</CODE>
1170 <DD>
1171 <A NAME="IDX48"></A>
1172 Delete the character behind the cursor. A numeric argument means
1173 to kill the characters instead of deleting them.
1174
1175 <DT><CODE>forward-backward-delete-char ()</CODE>
1176 <DD>
1177 <A NAME="IDX49"></A>
1178 Delete the character under the cursor, unless the cursor is at the
1179 end of the line, in which case the character behind the cursor is
1180 deleted. By default, this is not bound to a key.
1181
1182 <DT><CODE>quoted-insert (C-q, C-v)</CODE>
1183 <DD>
1184 <A NAME="IDX50"></A>
1185 Add the next character typed to the line verbatim. This is
1186 how to insert key sequences like <KBD>C-q</KBD>, for example.
1187
1188 <DT><CODE>tab-insert (M-TAB)</CODE>
1189 <DD>
1190 <A NAME="IDX51"></A>
1191 Insert a tab character.
1192
1193 <DT><CODE>self-insert (a, b, A, 1, !, ...)</CODE>
1194 <DD>
1195 <A NAME="IDX52"></A>
1196 Insert yourself.
1197
1198 <DT><CODE>transpose-chars (C-t)</CODE>
1199 <DD>
1200 <A NAME="IDX53"></A>
1201 Drag the character before the cursor forward over
1202 the character at the cursor, moving the
1203 cursor forward as well. If the insertion point
1204 is at the end of the line, then this
1205 transposes the last two characters of the line.
1206 Negative arguments have no effect.
1207
1208 <DT><CODE>transpose-words (M-t)</CODE>
1209 <DD>
1210 <A NAME="IDX54"></A>
1211 Drag the word before point past the word after point,
1212 moving point past that word as well.
1213
1214 <DT><CODE>upcase-word (M-u)</CODE>
1215 <DD>
1216 <A NAME="IDX55"></A>
1217 Uppercase the current (or following) word. With a negative argument,
1218 uppercase the previous word, but do not move the cursor.
1219
1220 <DT><CODE>downcase-word (M-l)</CODE>
1221 <DD>
1222 <A NAME="IDX56"></A>
1223 Lowercase the current (or following) word. With a negative argument,
1224 lowercase the previous word, but do not move the cursor.
1225
1226 <DT><CODE>capitalize-word (M-c)</CODE>
1227 <DD>
1228 <A NAME="IDX57"></A>
1229 Capitalize the current (or following) word. With a negative argument,
1230 capitalize the previous word, but do not move the cursor.
1231
1232 </DL>
1233
1234
1235
1236 <H3><A NAME="SEC17" HREF="rluserman.html#TOC17">Killing And Yanking</A></H3>
1237
1238 <DL COMPACT>
1239
1240 <DT><CODE>kill-line (C-k)</CODE>
1241 <DD>
1242 <A NAME="IDX58"></A>
1243 Kill the text from point to the end of the line.
1244
1245 <DT><CODE>backward-kill-line (C-x Rubout)</CODE>
1246 <DD>
1247 <A NAME="IDX59"></A>
1248 Kill backward to the beginning of the line.
1249
1250 <DT><CODE>unix-line-discard (C-u)</CODE>
1251 <DD>
1252 <A NAME="IDX60"></A>
1253 Kill backward from the cursor to the beginning of the current line.
1254
1255 <DT><CODE>kill-whole-line ()</CODE>
1256 <DD>
1257 <A NAME="IDX61"></A>
1258 Kill all characters on the current line, no matter point is.
1259 By default, this is unbound.
1260
1261 <DT><CODE>kill-word (M-d)</CODE>
1262 <DD>
1263 <A NAME="IDX62"></A>
1264 Kill from point to the end of the current word, or if between
1265 words, to the end of the next word.
1266 Word boundaries are the same as <CODE>forward-word</CODE>.
1267
1268 <DT><CODE>backward-kill-word (M-DEL)</CODE>
1269 <DD>
1270 <A NAME="IDX63"></A>
1271 Kill the word behind point.
1272 Word boundaries are the same as <CODE>backward-word</CODE>.
1273
1274 <DT><CODE>unix-word-rubout (C-w)</CODE>
1275 <DD>
1276 <A NAME="IDX64"></A>
1277 Kill the word behind point, using white space as a word boundary.
1278 The killed text is saved on the kill-ring.
1279
1280 <DT><CODE>delete-horizontal-space ()</CODE>
1281 <DD>
1282 <A NAME="IDX65"></A>
1283 Delete all spaces and tabs around point. By default, this is unbound.
1284
1285 <DT><CODE>kill-region ()</CODE>
1286 <DD>
1287 <A NAME="IDX66"></A>
1288 Kill the text in the current region.
1289 By default, this command is unbound.
1290
1291 <DT><CODE>copy-region-as-kill ()</CODE>
1292 <DD>
1293 <A NAME="IDX67"></A>
1294 Copy the text in the region to the kill buffer, so it can be yanked
1295 right away. By default, this command is unbound.
1296
1297 <DT><CODE>copy-backward-word ()</CODE>
1298 <DD>
1299 <A NAME="IDX68"></A>
1300 Copy the word before point to the kill buffer.
1301 The word boundaries are the same as <CODE>backward-word</CODE>.
1302 By default, this command is unbound.
1303
1304 <DT><CODE>copy-forward-word ()</CODE>
1305 <DD>
1306 <A NAME="IDX69"></A>
1307 Copy the word following point to the kill buffer.
1308 The word boundaries are the same as <CODE>forward-word</CODE>.
1309 By default, this command is unbound.
1310
1311 <DT><CODE>yank (C-y)</CODE>
1312 <DD>
1313 <A NAME="IDX70"></A>
1314 Yank the top of the kill ring into the buffer at the current
1315 cursor position.
1316
1317 <DT><CODE>yank-pop (M-y)</CODE>
1318 <DD>
1319 <A NAME="IDX71"></A>
1320 Rotate the kill-ring, and yank the new top. You can only do this if
1321 the prior command is yank or yank-pop.
1322 </DL>
1323
1324
1325
1326 <H3><A NAME="SEC18" HREF="rluserman.html#TOC18">Specifying Numeric Arguments</A></H3>
1327 <DL COMPACT>
1328
1329 <DT><CODE>digit-argument (M-0, M-1, ... M--)</CODE>
1330 <DD>
1331 <A NAME="IDX72"></A>
1332 Add this digit to the argument already accumulating, or start a new
1333 argument. <KBD>M--</KBD> starts a negative argument.
1334
1335 <DT><CODE>universal-argument ()</CODE>
1336 <DD>
1337 <A NAME="IDX73"></A>
1338 This is another way to specify an argument.
1339 If this command is followed by one or more digits, optionally with a
1340 leading minus sign, those digits define the argument.
1341 If the command is followed by digits, executing <CODE>universal-argument</CODE>
1342 again ends the numeric argument, but is otherwise ignored.
1343 As a special case, if this command is immediately followed by a
1344 character that is neither a digit or minus sign, the argument count
1345 for the next command is multiplied by four.
1346 The argument count is initially one, so executing this function the
1347 first time makes the argument count four, a second time makes the
1348 argument count sixteen, and so on.
1349 By default, this is not bound to a key.
1350 </DL>
1351
1352
1353
1354 <H3><A NAME="SEC19" HREF="rluserman.html#TOC19">Letting Readline Type For You</A></H3>
1355
1356 <DL COMPACT>
1357
1358 <DT><CODE>complete (TAB)</CODE>
1359 <DD>
1360 <A NAME="IDX74"></A>
1361 Attempt to do completion on the text before the cursor. This is
1362 application-specific. Generally, if you are typing a filename
1363 argument, you can do filename completion; if you are typing a command,
1364 you can do command completion; if you are typing in a symbol to GDB, you
1365 can do symbol name completion; if you are typing in a variable to Bash,
1366 you can do variable name completion, and so on.
1367
1368 <DT><CODE>possible-completions (M-?)</CODE>
1369 <DD>
1370 <A NAME="IDX75"></A>
1371 List the possible completions of the text before the cursor.
1372
1373 <DT><CODE>insert-completions (M-*)</CODE>
1374 <DD>
1375 <A NAME="IDX76"></A>
1376 Insert all completions of the text before point that would have
1377 been generated by <CODE>possible-completions</CODE>.
1378
1379 <DT><CODE>menu-complete ()</CODE>
1380 <DD>
1381 <A NAME="IDX77"></A>
1382 Similar to <CODE>complete</CODE>, but replaces the word to be completed
1383 with a single match from the list of possible completions.
1384 Repeated execution of <CODE>menu-complete</CODE> steps through the list
1385 of possible completions, inserting each match in turn.
1386 At the end of the list of completions, the bell is rung and the
1387 original text is restored.
1388 An argument of <VAR>n</VAR> moves <VAR>n</VAR> positions forward in the list
1389 of matches; a negative argument may be used to move backward
1390 through the list.
1391 This command is intended to be bound to <CODE>TAB</CODE>, but is unbound
1392 by default.
1393
1394 <DT><CODE>delete-char-or-list ()</CODE>
1395 <DD>
1396 <A NAME="IDX78"></A>
1397 Deletes the character under the cursor if not at the beginning or
1398 end of the line (like <CODE>delete-char</CODE>).
1399 If at the end of the line, behaves identically to
1400 <CODE>possible-completions</CODE>.
1401 This command is unbound by default.
1402
1403 </DL>
1404
1405
1406
1407 <H3><A NAME="SEC20" HREF="rluserman.html#TOC20">Keyboard Macros</A></H3>
1408 <DL COMPACT>
1409
1410 <DT><CODE>start-kbd-macro (C-x ()</CODE>
1411 <DD>
1412 <A NAME="IDX79"></A>
1413 Begin saving the characters typed into the current keyboard macro.
1414
1415 <DT><CODE>end-kbd-macro (C-x ))</CODE>
1416 <DD>
1417 <A NAME="IDX80"></A>
1418 Stop saving the characters typed into the current keyboard macro
1419 and save the definition.
1420
1421 <DT><CODE>call-last-kbd-macro (C-x e)</CODE>
1422 <DD>
1423 <A NAME="IDX81"></A>
1424 Re-execute the last keyboard macro defined, by making the characters
1425 in the macro appear as if typed at the keyboard.
1426
1427 </DL>
1428
1429
1430
1431 <H3><A NAME="SEC21" HREF="rluserman.html#TOC21">Some Miscellaneous Commands</A></H3>
1432 <DL COMPACT>
1433
1434 <DT><CODE>re-read-init-file (C-x C-r)</CODE>
1435 <DD>
1436 <A NAME="IDX82"></A>
1437 Read in the contents of the <VAR>inputrc</VAR> file, and incorporate
1438 any bindings or variable assignments found there.
1439
1440 <DT><CODE>abort (C-g)</CODE>
1441 <DD>
1442 <A NAME="IDX83"></A>
1443 Abort the current editing command and
1444 ring the terminal's bell (subject to the setting of
1445 <CODE>bell-style</CODE>).
1446
1447 <DT><CODE>do-uppercase-version (M-a, M-b, M-<VAR>x</VAR>, ...)</CODE>
1448 <DD>
1449 <A NAME="IDX84"></A>
1450 If the metafied character <VAR>x</VAR> is lowercase, run the command
1451 that is bound to the corresponding uppercase character.
1452
1453 <DT><CODE>prefix-meta (ESC)</CODE>
1454 <DD>
1455 <A NAME="IDX85"></A>
1456 Make the next character typed be metafied. This is for keyboards
1457 without a meta key. Typing <SAMP>`ESC f'</SAMP> is equivalent to typing
1458 <SAMP>`M-f'</SAMP>.
1459
1460 <DT><CODE>undo (C-_, C-x C-u)</CODE>
1461 <DD>
1462 <A NAME="IDX86"></A>
1463 Incremental undo, separately remembered for each line.
1464
1465 <DT><CODE>revert-line (M-r)</CODE>
1466 <DD>
1467 <A NAME="IDX87"></A>
1468 Undo all changes made to this line. This is like executing the <CODE>undo</CODE>
1469 command enough times to get back to the beginning.
1470
1471 <DT><CODE>tilde-expand (M-~)</CODE>
1472 <DD>
1473 <A NAME="IDX88"></A>
1474 Perform tilde expansion on the current word.
1475
1476 <DT><CODE>set-mark (C-@)</CODE>
1477 <DD>
1478 <A NAME="IDX89"></A>
1479 Set the mark to the current point. If a
1480 numeric argument is supplied, the mark is set to that position.
1481
1482 <DT><CODE>exchange-point-and-mark (C-x C-x)</CODE>
1483 <DD>
1484 <A NAME="IDX90"></A>
1485 Swap the point with the mark. The current cursor position is set to
1486 the saved position, and the old cursor position is saved as the mark.
1487
1488 <DT><CODE>character-search (C-])</CODE>
1489 <DD>
1490 <A NAME="IDX91"></A>
1491 A character is read and point is moved to the next occurrence of that
1492 character. A negative count searches for previous occurrences.
1493
1494 <DT><CODE>character-search-backward (M-C-])</CODE>
1495 <DD>
1496 <A NAME="IDX92"></A>
1497 A character is read and point is moved to the previous occurrence
1498 of that character. A negative count searches for subsequent
1499 occurrences.
1500
1501 <DT><CODE>insert-comment (M-#)</CODE>
1502 <DD>
1503 <A NAME="IDX93"></A>
1504 The value of the <CODE>comment-begin</CODE>
1505 variable is inserted at the beginning of the current line,
1506 and the line is accepted as if a newline had been typed.
1507
1508 <DT><CODE>dump-functions ()</CODE>
1509 <DD>
1510 <A NAME="IDX94"></A>
1511 Print all of the functions and their key bindings to the
1512 Readline output stream. If a numeric argument is supplied,
1513 the output is formatted in such a way that it can be made part
1514 of an <VAR>inputrc</VAR> file. This command is unbound by default.
1515
1516 <DT><CODE>dump-variables ()</CODE>
1517 <DD>
1518 <A NAME="IDX95"></A>
1519 Print all of the settable variables and their values to the
1520 Readline output stream. If a numeric argument is supplied,
1521 the output is formatted in such a way that it can be made part
1522 of an <VAR>inputrc</VAR> file. This command is unbound by default.
1523
1524 <DT><CODE>dump-macros ()</CODE>
1525 <DD>
1526 <A NAME="IDX96"></A>
1527 Print all of the Readline key sequences bound to macros and the
1528 strings they ouput. If a numeric argument is supplied,
1529 the output is formatted in such a way that it can be made part
1530 of an <VAR>inputrc</VAR> file. This command is unbound by default.
1531
1532 </DL>
1533
1534
1535
1536 <H2><A NAME="SEC22" HREF="rluserman.html#TOC22">Readline vi Mode</A></H2>
1537
1538 <P>
1539 While the Readline library does not have a full set of <CODE>vi</CODE>
1540 editing functions, it does contain enough to allow simple editing
1541 of the line. The Readline <CODE>vi</CODE> mode behaves as specified in
1542 the POSIX 1003.2 standard.
1543
1544 </P>
1545 <P>
1546 In order to switch interactively between <CODE>emacs</CODE> and <CODE>vi</CODE>
1547 editing modes, use the command M-C-j (toggle-editing-mode).
1548 The Readline default is <CODE>emacs</CODE> mode.
1549
1550 </P>
1551 <P>
1552 When you enter a line in <CODE>vi</CODE> mode, you are already placed in
1553 `insertion' mode, as if you had typed an <SAMP>`i'</SAMP>. Pressing <KBD>ESC</KBD>
1554 switches you into `command' mode, where you can edit the text of the
1555 line with the standard <CODE>vi</CODE> movement keys, move to previous
1556 history lines with <SAMP>`k'</SAMP> and subsequent lines with <SAMP>`j'</SAMP>, and
1557 so forth.
1558
1559 </P>
1560
1561 <P><HR><P>
1562 This document was generated on 1 March 2000 using the
1563 <A HREF="http://wwwinfo.cern.ch/dis/texi2html/">texi2html</A>
1564 translator version 1.52.</P>
1565 </BODY>
1566 </HTML>
This page took 0.063497 seconds and 3 git commands to generate.