1 This is Info file rluserman.info, produced by Makeinfo version 1.68
3 /usr/homes/chet/src/bash/readline-src/doc/rluserman.texinfo.
5 INFO-DIR-SECTION Libraries
7 * Readline: (readline). The GNU readline library API
10 This document describes the end user interface of the GNU Readline
11 Library, a utility which aids in the consistency of user interface
12 across discrete programs that need to provide a command line interface.
14 Copyright (C) 1988-1999 Free Software Foundation, Inc.
16 Permission is granted to make and distribute verbatim copies of this
17 manual provided the copyright notice and this permission notice pare
18 preserved on all copies.
20 Permission is granted to copy and distribute modified versions of
21 this manual under the conditions for verbatim copying, provided that
22 the entire resulting derived work is distributed under the terms of a
23 permission notice identical to this one.
25 Permission is granted to copy and distribute translations of this
26 manual into another language, under the above conditions for modified
27 versions, except that this permission notice may be stated in a
28 translation approved by the Free Software Foundation.
31 File: rluserman.info, Node: Top, Next: Command Line Editing, Up: (dir)
36 This document describes the end user interface of the GNU Readline
37 Library, a utility which aids in the consistency of user interface
38 across discrete programs that need to provide a command line interface.
42 * Command Line Editing:: GNU Readline User's Manual.
45 File: rluserman.info, Node: Command Line Editing, Prev: Top, Up: Top
50 This chapter describes the basic features of the GNU command line
55 * Introduction and Notation:: Notation used in this text.
56 * Readline Interaction:: The minimum set of commands for editing a line.
57 * Readline Init File:: Customizing Readline from a user's view.
58 * Bindable Readline Commands:: A description of most of the Readline commands
60 * Readline vi Mode:: A short description of how to make Readline
61 behave like the vi editor.
64 File: rluserman.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
66 Introduction to Line Editing
67 ============================
69 The following paragraphs describe the notation used to represent
72 The text <C-k> is read as `Control-K' and describes the character
73 produced when the <k> key is pressed while the Control key is depressed.
75 The text <M-k> is read as `Meta-K' and describes the character
76 produced when the Meta key (if you have one) is depressed, and the <k>
77 key is pressed. The Meta key is labeled <ALT> on many keyboards. On
78 keyboards with two keys labeled <ALT> (usually to either side of the
79 space bar), the <ALT> on the left side is generally set to work as a
80 Meta key. The <ALT> key on the right may also be configured to work as
81 a Meta key or may be configured as some other modifier, such as a
82 Compose key for typing accented characters.
84 If you do not have a Meta or <ALT> key, or another key working as a
85 Meta key, the identical keystroke can be generated by typing <ESC>
86 first, and then typing <k>. Either process is known as "metafying" the
89 The text <M-C-k> is read as `Meta-Control-k' and describes the
90 character produced by "metafying" <C-k>.
92 In addition, several keys have their own names. Specifically,
93 <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
94 when seen in this text, or in an init file (*note Readline Init
95 File::.). If your keyboard lacks a <LFD> key, typing <C-j> will
96 produce the desired character. The <RET> key may be labeled <Return>
97 or <Enter> on some keyboards.
100 File: rluserman.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
105 Often during an interactive session you type in a long line of text,
106 only to notice that the first word on the line is misspelled. The
107 Readline library gives you a set of commands for manipulating the text
108 as you type it in, allowing you to just fix your typo, and not forcing
109 you to retype the majority of the line. Using these editing commands,
110 you move the cursor to the place that needs correction, and delete or
111 insert the text of the corrections. Then, when you are satisfied with
112 the line, you simply press <RETURN>. You do not have to be at the end
113 of the line to press <RETURN>; the entire line is accepted regardless
114 of the location of the cursor within the line.
118 * Readline Bare Essentials:: The least you need to know about Readline.
119 * Readline Movement Commands:: Moving about the input line.
120 * Readline Killing Commands:: How to delete text, and how to get it back!
121 * Readline Arguments:: Giving numeric arguments to commands.
122 * Searching:: Searching through previous lines.
125 File: rluserman.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
127 Readline Bare Essentials
128 ------------------------
130 In order to enter characters into the line, simply type them. The
131 typed character appears where the cursor was, and then the cursor moves
132 one space to the right. If you mistype a character, you can use your
133 erase character to back up and delete the mistyped character.
135 Sometimes you may mistype a character, and not notice the error
136 until you have typed several other characters. In that case, you can
137 type <C-b> to move the cursor to the left, and then correct your
138 mistake. Afterwards, you can move the cursor to the right with <C-f>.
140 When you add text in the middle of a line, you will notice that
141 characters to the right of the cursor are `pushed over' to make room
142 for the text that you have inserted. Likewise, when you delete text
143 behind the cursor, characters to the right of the cursor are `pulled
144 back' to fill in the blank space created by the removal of the text. A
145 list of the bare essentials for editing the text of an input line
149 Move back one character.
152 Move forward one character.
155 Delete the character to the left of the cursor.
158 Delete the character underneath the cursor.
161 Insert the character into the line at the cursor.
164 Undo the last editing command. You can undo all the way back to an
167 (Depending on your configuration, the <Backspace> key be set to delete
168 the character to the left of the cursor and the <DEL> key set to delete
169 the character underneath the cursor, like <C-d>, rather than the
170 character to the left of the cursor.)
173 File: rluserman.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
175 Readline Movement Commands
176 --------------------------
178 The above table describes the most basic keystrokes that you need in
179 order to do editing of the input line. For your convenience, many
180 other commands have been added in addition to <C-b>, <C-f>, <C-d>, and
181 <DEL>. Here are some commands for moving more rapidly about the line.
184 Move to the start of the line.
187 Move to the end of the line.
190 Move forward a word, where a word is composed of letters and
194 Move backward a word.
197 Clear the screen, reprinting the current line at the top.
199 Notice how <C-f> moves forward a character, while <M-f> moves
200 forward a word. It is a loose convention that control keystrokes
201 operate on characters while meta keystrokes operate on words.
204 File: rluserman.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
206 Readline Killing Commands
207 -------------------------
209 "Killing" text means to delete the text from the line, but to save
210 it away for later use, usually by "yanking" (re-inserting) it back into
211 the line. (`Cut' and `paste' are more recent jargon for `kill' and
214 If the description for a command says that it `kills' text, then you
215 can be sure that you can get the text back in a different (or the same)
218 When you use a kill command, the text is saved in a "kill-ring".
219 Any number of consecutive kills save all of the killed text together, so
220 that when you yank it back, you get it all. The kill ring is not line
221 specific; the text that you killed on a previously typed line is
222 available to be yanked back later, when you are typing another line.
224 Here is the list of commands for killing text.
227 Kill the text from the current cursor position to the end of the
231 Kill from the cursor to the end of the current word, or, if between
232 words, to the end of the next word. Word boundaries are the same
233 as those used by <M-f>.
236 Kill from the cursor the start of the previous word, or, if between
237 words, to the start of the previous word. Word boundaries are the
238 same as those used by <M-b>.
241 Kill from the cursor to the previous whitespace. This is
242 different than <M-DEL> because the word boundaries differ.
244 Here is how to "yank" the text back into the line. Yanking means to
245 copy the most-recently-killed text from the kill buffer.
248 Yank the most recently killed text back into the buffer at the
252 Rotate the kill-ring, and yank the new top. You can only do this
253 if the prior command is <C-y> or <M-y>.
256 File: rluserman.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
261 You can pass numeric arguments to Readline commands. Sometimes the
262 argument acts as a repeat count, other times it is the sign of the
263 argument that is significant. If you pass a negative argument to a
264 command which normally acts in a forward direction, that command will
265 act in a backward direction. For example, to kill text back to the
266 start of the line, you might type `M-- C-k'.
268 The general way to pass numeric arguments to a command is to type
269 meta digits before the command. If the first `digit' typed is a minus
270 sign (`-'), then the sign of the argument will be negative. Once you
271 have typed one meta digit to get the argument started, you can type the
272 remainder of the digits, and then the command. For example, to give
273 the <C-d> command an argument of 10, you could type `M-1 0 C-d'.
276 File: rluserman.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
278 Searching for Commands in the History
279 -------------------------------------
281 Readline provides commands for searching through the command history
282 for lines containing a specified string. There are two search modes:
283 INCREMENTAL and NON-INCREMENTAL.
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
290 history for a particular string, type <C-r>. Typing <C-s> searches
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
294 <C-J> characters will terminate an incremental search. <C-g> will
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.
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
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
307 Non-incremental searches read the entire search string before
308 starting to search for matching history lines. The search string may be
309 typed by the user or be part of the contents of the current line.
312 File: rluserman.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
317 Although the Readline library comes with a set of Emacs-like
318 keybindings installed by default, it is possible to use a different set
319 of keybindings. Any user can customize programs that use Readline by
320 putting commands in an "inputrc" file, conventionally in his home
321 directory. The name of this file is taken from the value of the
322 environment variable `INPUTRC'. If that variable is unset, the default
325 When a program which uses the Readline library starts up, the init
326 file is read, and the key bindings are set.
328 In addition, the `C-x C-r' command re-reads this init file, thus
329 incorporating any changes that you might have made to it.
333 * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
335 * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
337 * Sample Init File:: An example inputrc file.
340 File: rluserman.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
342 Readline Init File Syntax
343 -------------------------
345 There are only a few basic constructs allowed in the Readline init
346 file. Blank lines are ignored. Lines beginning with a `#' are
347 comments. Lines beginning with a `$' indicate conditional constructs
348 (*note Conditional Init Constructs::.). Other lines denote variable
349 settings and key bindings.
352 You can modify the run-time behavior of Readline by altering the
353 values of variables in Readline using the `set' command within the
354 init file. Here is how to change from the default Emacs-like key
355 binding to use `vi' line editing commands:
359 A great deal of run-time behavior is changeable with the following
363 Controls what happens when Readline wants to ring the
364 terminal bell. If set to `none', Readline never rings the
365 bell. If set to `visible', Readline uses a visible bell if
366 one is available. If set to `audible' (the default),
367 Readline attempts to ring the terminal's bell.
370 The string to insert at the beginning of the line when the
371 `insert-comment' command is executed. The default value is
374 `completion-ignore-case'
375 If set to `on', Readline performs filename matching and
376 completion in a case-insensitive fashion. The default value
379 `completion-query-items'
380 The number of possible completions that determines when the
381 user is asked whether he wants to see the list of
382 possibilities. If the number of possible completions is
383 greater than this value, Readline will ask the user whether
384 or not he wishes to view them; otherwise, they are simply
385 listed. The default limit is `100'.
388 If set to `on', Readline will convert characters with the
389 eighth bit set to an ASCII key sequence by stripping the
390 eighth bit and prefixing an <ESC> character, converting them
391 to a meta-prefixed key sequence. The default value is `on'.
394 If set to `On', Readline will inhibit word completion.
395 Completion characters will be inserted into the line as if
396 they had been mapped to `self-insert'. The default is `off'.
399 The `editing-mode' variable controls which default set of key
400 bindings is used. By default, Readline starts up in Emacs
401 editing mode, where the keystrokes are most similar to Emacs.
402 This variable can be set to either `emacs' or `vi'.
405 When set to `on', Readline will try to enable the application
406 keypad when it is called. Some systems need this to enable
407 the arrow keys. The default is `off'.
410 If set to `on', tilde expansion is performed when Readline
411 attempts word completion. The default is `off'.
413 `horizontal-scroll-mode'
414 This variable can be set to either `on' or `off'. Setting it
415 to `on' means that the text of the lines being edited will
416 scroll horizontally on a single screen line when they are
417 longer than the width of the screen, instead of wrapping onto
418 a new screen line. By default, this variable is set to `off'.
421 If set to `on', Readline will enable eight-bit input (it will
422 not strip the eighth bit from the characters it reads),
423 regardless of what the terminal claims it can support. The
424 default value is `off'. The name `meta-flag' is a synonym
427 `isearch-terminators'
428 The string of characters that should terminate an incremental
429 search without subsequently executing the character as a
430 command (*note Searching::.). If this variable has not been
431 given a value, the characters <ESC> and <C-J> will terminate
432 an incremental search.
435 Sets Readline's idea of the current keymap for key binding
436 commands. Acceptable `keymap' names are `emacs',
437 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi',
438 `vi-command', and `vi-insert'. `vi' is equivalent to
439 `vi-command'; `emacs' is equivalent to `emacs-standard'. The
440 default value is `emacs'. The value of the `editing-mode'
441 variable also affects the default keymap.
444 If set to `on', completed directory names have a slash
445 appended. The default is `on'.
447 `mark-modified-lines'
448 This variable, when set to `on', causes Readline to display an
449 asterisk (`*') at the start of history lines which have been
450 modified. This variable is `off' by default.
453 If set to `on', Readline will display characters with the
454 eighth bit set directly rather than as a meta-prefixed escape
455 sequence. The default is `off'.
457 `print-completions-horizontally'
458 If set to `on', Readline will display completions with matches
459 sorted horizontally in alphabetical order, rather than down
460 the screen. The default is `off'.
462 `show-all-if-ambiguous'
463 This alters the default behavior of the completion functions.
464 If set to `on', words which have more than one possible
465 completion cause the matches to be listed immediately instead
466 of ringing the bell. The default value is `off'.
469 If set to `on', a character denoting a file's type is
470 appended to the filename when listing possible completions.
471 The default is `off'.
474 The syntax for controlling key bindings in the init file is
475 simple. First you need to find the name of the command that you
476 want to change. The following sections contain tables of the
477 command name, the default keybinding, if any, and a short
478 description of what the command does.
480 Once you know the name of the command, simply place the name of
481 the key you wish to bind the command to, a colon, and then the
482 name of the command on a line in the init file. The name of the
483 key can be expressed in different ways, depending on which is most
486 KEYNAME: FUNCTION-NAME or MACRO
487 KEYNAME is the name of a key spelled out in English. For
489 Control-u: universal-argument
490 Meta-Rubout: backward-kill-word
491 Control-o: "> output"
493 In the above example, <C-u> is bound to the function
494 `universal-argument', and <C-o> is bound to run the macro
495 expressed on the right hand side (that is, to insert the text
496 `> output' into the line).
498 "KEYSEQ": FUNCTION-NAME or MACRO
499 KEYSEQ differs from KEYNAME above in that strings denoting an
500 entire key sequence can be specified, by placing the key
501 sequence in double quotes. Some GNU Emacs style key escapes
502 can be used, as in the following example, but the special
503 character names are not recognized.
505 "\C-u": universal-argument
506 "\C-x\C-r": re-read-init-file
507 "\e[11~": "Function Key 1"
509 In the above example, <C-u> is bound to the function
510 `universal-argument' (just as it was in the first example),
511 `<C-x> <C-r>' is bound to the function `re-read-init-file',
512 and `<ESC> <[> <1> <1> <~>' is bound to insert the text
515 The following GNU Emacs style escape sequences are available when
516 specifying key sequences:
531 <">, a double quotation mark
534 <'>, a single quote or apostrophe
536 In addition to the GNU Emacs style escape sequences, a second set
537 of backslash escapes is available:
564 the character whose `ASCII' code is the octal value NNN (one
568 the character whose `ASCII' code is the hexadecimal value NNN
569 (one to three digits)
571 When entering the text of a macro, single or double quotes must be
572 used to indicate a macro definition. Unquoted text is assumed to
573 be a function name. In the macro body, the backslash escapes
574 described above are expanded. Backslash will quote any other
575 character in the macro text, including `"' and `''. For example,
576 the following binding will make `C-x \' insert a single `\' into
581 File: rluserman.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
583 Conditional Init Constructs
584 ---------------------------
586 Readline implements a facility similar in spirit to the conditional
587 compilation features of the C preprocessor which allows key bindings
588 and variable settings to be performed as the result of tests. There
589 are four parser directives used.
592 The `$if' construct allows bindings to be made based on the
593 editing mode, the terminal being used, or the application using
594 Readline. The text of the test extends to the end of the line; no
595 characters are required to isolate it.
598 The `mode=' form of the `$if' directive is used to test
599 whether Readline is in `emacs' or `vi' mode. This may be
600 used in conjunction with the `set keymap' command, for
601 instance, to set bindings in the `emacs-standard' and
602 `emacs-ctlx' keymaps only if Readline is starting out in
606 The `term=' form may be used to include terminal-specific key
607 bindings, perhaps to bind the key sequences output by the
608 terminal's function keys. The word on the right side of the
609 `=' is tested against both the full name of the terminal and
610 the portion of the terminal name before the first `-'. This
611 allows `sun' to match both `sun' and `sun-cmd', for instance.
614 The APPLICATION construct is used to include
615 application-specific settings. Each program using the
616 Readline library sets the APPLICATION NAME, and you can test
617 for it. This could be used to bind key sequences to
618 functions useful for a specific program. For instance, the
619 following command adds a key sequence that quotes the current
620 or previous word in Bash:
622 # Quote the current or previous word
623 "\C-xq": "\eb\"\ef\""
627 This command, as seen in the previous example, terminates an `$if'
631 Commands in this branch of the `$if' directive are executed if the
635 This directive takes a single filename as an argument and reads
636 commands and bindings from that file.
637 $include /etc/inputrc
640 File: rluserman.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
645 Here is an example of an inputrc file. This illustrates key
646 binding, variable assignment, and conditional syntax.
649 # This file controls the behaviour of line input editing for
650 # programs that use the Gnu Readline library. Existing programs
651 # include FTP, Bash, and Gdb.
653 # You can re-read the inputrc file with C-x C-r.
654 # Lines beginning with '#' are comments.
656 # First, include any systemwide bindings and variable assignments from
658 $include /etc/Inputrc
661 # Set various bindings for emacs mode.
663 set editing-mode emacs
667 Meta-Control-h: backward-kill-word Text after the function name is ignored
670 # Arrow keys in keypad mode
672 #"\M-OD": backward-char
673 #"\M-OC": forward-char
674 #"\M-OA": previous-history
675 #"\M-OB": next-history
677 # Arrow keys in ANSI mode
679 "\M-[D": backward-char
680 "\M-[C": forward-char
681 "\M-[A": previous-history
682 "\M-[B": next-history
684 # Arrow keys in 8 bit keypad mode
686 #"\M-\C-OD": backward-char
687 #"\M-\C-OC": forward-char
688 #"\M-\C-OA": previous-history
689 #"\M-\C-OB": next-history
691 # Arrow keys in 8 bit ANSI mode
693 #"\M-\C-[D": backward-char
694 #"\M-\C-[C": forward-char
695 #"\M-\C-[A": previous-history
696 #"\M-\C-[B": next-history
702 # An old-style binding. This happens to be the default.
705 # Macros that are convenient for shell interaction
708 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
709 # prepare to type a quoted word -- insert open and close double quotes
710 # and move to just after the open quote
712 # insert a backslash (testing backslash escapes in sequences and macros)
714 # Quote the current or previous word
715 "\C-xq": "\eb\"\ef\""
716 # Add a binding to refresh the line, which is unbound
717 "\C-xr": redraw-current-line
718 # Edit variable on current line.
719 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
722 # use a visible bell if one is available
723 set bell-style visible
725 # don't strip characters to 7 bits when reading
728 # allow iso-latin1 characters to be inserted rather than converted to
729 # prefix-meta sequences
732 # display characters with the eighth bit set directly rather than
733 # as meta-prefixed characters
736 # if there are more than 150 possible completions for a word, ask the
737 # user if he wants to see all of them
738 set completion-query-items 150
744 "\M-.": yank-last-arg
748 File: rluserman.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
750 Bindable Readline Commands
751 ==========================
755 * Commands For Moving:: Moving about the line.
756 * Commands For History:: Getting at previous lines.
757 * Commands For Text:: Commands for changing text.
758 * Commands For Killing:: Commands for killing and yanking.
759 * Numeric Arguments:: Specifying numeric arguments, repeat counts.
760 * Commands For Completion:: Getting Readline to do the typing for you.
761 * Keyboard Macros:: Saving and re-executing typed characters
762 * Miscellaneous Commands:: Other miscellaneous commands.
764 This section describes Readline commands that may be bound to key
767 Command names without an accompanying key sequence are unbound by
768 default. In the following descriptions, POINT refers to the current
769 cursor position, and MARK refers to a cursor position saved by the
770 `set-mark' command. The text between the point and mark is referred to
774 File: rluserman.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
779 `beginning-of-line (C-a)'
780 Move to the start of the current line.
783 Move to the end of the line.
786 Move forward a character.
788 `backward-char (C-b)'
789 Move back a character.
792 Move forward to the end of the next word. Words are composed of
795 `backward-word (M-b)'
796 Move back to the start of the current or previous word. Words are
797 composed of letters and digits.
800 Clear the screen and redraw the current line, leaving the current
801 line at the top of the screen.
803 `redraw-current-line ()'
804 Refresh the current line. By default, this is unbound.
807 File: rluserman.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
809 Commands For Manipulating The History
810 -------------------------------------
812 `accept-line (Newline, Return)'
813 Accept the line regardless of where the cursor is. If this line is
814 non-empty, add it to the history list. If this line was a history
815 line, then restore the history line to its original state.
817 `previous-history (C-p)'
818 Move `up' through the history list.
821 Move `down' through the history list.
823 `beginning-of-history (M-<)'
824 Move to the first line in the history.
826 `end-of-history (M->)'
827 Move to the end of the input history, i.e., the line currently
830 `reverse-search-history (C-r)'
831 Search backward starting at the current line and moving `up'
832 through the history as necessary. This is an incremental search.
834 `forward-search-history (C-s)'
835 Search forward starting at the current line and moving `down'
836 through the the history as necessary. This is an incremental
839 `non-incremental-reverse-search-history (M-p)'
840 Search backward starting at the current line and moving `up'
841 through the history as necessary using a non-incremental search
842 for a string supplied by the user.
844 `non-incremental-forward-search-history (M-n)'
845 Search forward starting at the current line and moving `down'
846 through the the history as necessary using a non-incremental search
847 for a string supplied by the user.
849 `history-search-forward ()'
850 Search forward through the history for the string of characters
851 between the start of the current line and the point. This is a
852 non-incremental search. By default, this command is unbound.
854 `history-search-backward ()'
855 Search backward through the history for the string of characters
856 between the start of the current line and the point. This is a
857 non-incremental search. By default, this command is unbound.
859 `yank-nth-arg (M-C-y)'
860 Insert the first argument to the previous command (usually the
861 second word on the previous line). With an argument N, insert the
862 Nth word from the previous command (the words in the previous
863 command begin with word 0). A negative argument inserts the Nth
864 word from the end of the previous command.
866 `yank-last-arg (M-., M-_)'
867 Insert last argument to the previous command (the last word of the
868 previous history entry). With an argument, behave exactly like
869 `yank-nth-arg'. Successive calls to `yank-last-arg' move back
870 through the history list, inserting the last argument of each line
874 File: rluserman.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
876 Commands For Changing Text
877 --------------------------
880 Delete the character under the cursor. If the cursor is at the
881 beginning of the line, there are no characters in the line, and
882 the last character typed was not bound to `delete-char', then
885 `backward-delete-char (Rubout)'
886 Delete the character behind the cursor. A numeric argument means
887 to kill the characters instead of deleting them.
889 `forward-backward-delete-char ()'
890 Delete the character under the cursor, unless the cursor is at the
891 end of the line, in which case the character behind the cursor is
892 deleted. By default, this is not bound to a key.
894 `quoted-insert (C-q, C-v)'
895 Add the next character typed to the line verbatim. This is how to
896 insert key sequences like <C-q>, for example.
899 Insert a tab character.
901 `self-insert (a, b, A, 1, !, ...)'
904 `transpose-chars (C-t)'
905 Drag the character before the cursor forward over the character at
906 the cursor, moving the cursor forward as well. If the insertion
907 point is at the end of the line, then this transposes the last two
908 characters of the line. Negative arguments have no effect.
910 `transpose-words (M-t)'
911 Drag the word before point past the word after point, moving point
912 past that word as well.
915 Uppercase the current (or following) word. With a negative
916 argument, uppercase the previous word, but do not move the cursor.
918 `downcase-word (M-l)'
919 Lowercase the current (or following) word. With a negative
920 argument, lowercase the previous word, but do not move the cursor.
922 `capitalize-word (M-c)'
923 Capitalize the current (or following) word. With a negative
924 argument, capitalize the previous word, but do not move the cursor.
927 File: rluserman.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
933 Kill the text from point to the end of the line.
935 `backward-kill-line (C-x Rubout)'
936 Kill backward to the beginning of the line.
938 `unix-line-discard (C-u)'
939 Kill backward from the cursor to the beginning of the current line.
942 Kill all characters on the current line, no matter point is. By
943 default, this is unbound.
946 Kill from point to the end of the current word, or if between
947 words, to the end of the next word. Word boundaries are the same
950 `backward-kill-word (M-DEL)'
951 Kill the word behind point. Word boundaries are the same as
954 `unix-word-rubout (C-w)'
955 Kill the word behind point, using white space as a word boundary.
956 The killed text is saved on the kill-ring.
958 `delete-horizontal-space ()'
959 Delete all spaces and tabs around point. By default, this is
963 Kill the text in the current region. By default, this command is
966 `copy-region-as-kill ()'
967 Copy the text in the region to the kill buffer, so it can be yanked
968 right away. By default, this command is unbound.
970 `copy-backward-word ()'
971 Copy the word before point to the kill buffer. The word
972 boundaries are the same as `backward-word'. By default, this
975 `copy-forward-word ()'
976 Copy the word following point to the kill buffer. The word
977 boundaries are the same as `forward-word'. By default, this
981 Yank the top of the kill ring into the buffer at the current
985 Rotate the kill-ring, and yank the new top. You can only do this
986 if the prior command is yank or yank-pop.
989 File: rluserman.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
991 Specifying Numeric Arguments
992 ----------------------------
994 `digit-argument (M-0, M-1, ... M--)'
995 Add this digit to the argument already accumulating, or start a new
996 argument. <M-> starts a negative argument.
998 `universal-argument ()'
999 This is another way to specify an argument. If this command is
1000 followed by one or more digits, optionally with a leading minus
1001 sign, those digits define the argument. If the command is
1002 followed by digits, executing `universal-argument' again ends the
1003 numeric argument, but is otherwise ignored. As a special case, if
1004 this command is immediately followed by a character that is
1005 neither a digit or minus sign, the argument count for the next
1006 command is multiplied by four. The argument count is initially
1007 one, so executing this function the first time makes the argument
1008 count four, a second time makes the argument count sixteen, and so
1009 on. By default, this is not bound to a key.
1012 File: rluserman.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
1014 Letting Readline Type For You
1015 -----------------------------
1018 Attempt to do completion on the text before the cursor. This is
1019 application-specific. Generally, if you are typing a filename
1020 argument, you can do filename completion; if you are typing a
1021 command, you can do command completion; if you are typing in a
1022 symbol to GDB, you can do symbol name completion; if you are
1023 typing in a variable to Bash, you can do variable name completion,
1026 `possible-completions (M-?)'
1027 List the possible completions of the text before the cursor.
1029 `insert-completions (M-*)'
1030 Insert all completions of the text before point that would have
1031 been generated by `possible-completions'.
1034 Similar to `complete', but replaces the word to be completed with
1035 a single match from the list of possible completions. Repeated
1036 execution of `menu-complete' steps through the list of possible
1037 completions, inserting each match in turn. At the end of the list
1038 of completions, the bell is rung and the original text is restored.
1039 An argument of N moves N positions forward in the list of matches;
1040 a negative argument may be used to move backward through the list.
1041 This command is intended to be bound to `TAB', but is unbound by
1044 `delete-char-or-list ()'
1045 Deletes the character under the cursor if not at the beginning or
1046 end of the line (like `delete-char'). If at the end of the line,
1047 behaves identically to `possible-completions'. This command is
1051 File: rluserman.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
1056 `start-kbd-macro (C-x ()'
1057 Begin saving the characters typed into the current keyboard macro.
1059 `end-kbd-macro (C-x ))'
1060 Stop saving the characters typed into the current keyboard macro
1061 and save the definition.
1063 `call-last-kbd-macro (C-x e)'
1064 Re-execute the last keyboard macro defined, by making the
1065 characters in the macro appear as if typed at the keyboard.
1068 File: rluserman.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
1070 Some Miscellaneous Commands
1071 ---------------------------
1073 `re-read-init-file (C-x C-r)'
1074 Read in the contents of the INPUTRC file, and incorporate any
1075 bindings or variable assignments found there.
1078 Abort the current editing command and ring the terminal's bell
1079 (subject to the setting of `bell-style').
1081 `do-uppercase-version (M-a, M-b, M-X, ...)'
1082 If the metafied character X is lowercase, run the command that is
1083 bound to the corresponding uppercase character.
1086 Make the next character typed be metafied. This is for keyboards
1087 without a meta key. Typing `ESC f' is equivalent to typing `M-f'.
1089 `undo (C-_, C-x C-u)'
1090 Incremental undo, separately remembered for each line.
1093 Undo all changes made to this line. This is like executing the
1094 `undo' command enough times to get back to the beginning.
1096 `tilde-expand (M-~)'
1097 Perform tilde expansion on the current word.
1100 Set the mark to the current point. If a numeric argument is
1101 supplied, the mark is set to that position.
1103 `exchange-point-and-mark (C-x C-x)'
1104 Swap the point with the mark. The current cursor position is set
1105 to the saved position, and the old cursor position is saved as the
1108 `character-search (C-])'
1109 A character is read and point is moved to the next occurrence of
1110 that character. A negative count searches for previous
1113 `character-search-backward (M-C-])'
1114 A character is read and point is moved to the previous occurrence
1115 of that character. A negative count searches for subsequent
1118 `insert-comment (M-#)'
1119 The value of the `comment-begin' variable is inserted at the
1120 beginning of the current line, and the line is accepted as if a
1121 newline had been typed.
1124 Print all of the functions and their key bindings to the Readline
1125 output stream. If a numeric argument is supplied, the output is
1126 formatted in such a way that it can be made part of an INPUTRC
1127 file. This command is unbound by default.
1130 Print all of the settable variables and their values to the
1131 Readline output stream. If a numeric argument is supplied, the
1132 output is formatted in such a way that it can be made part of an
1133 INPUTRC file. This command is unbound by default.
1136 Print all of the Readline key sequences bound to macros and the
1137 strings they ouput. If a numeric argument is supplied, the output
1138 is formatted in such a way that it can be made part of an INPUTRC
1139 file. This command is unbound by default.
1142 File: rluserman.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
1147 While the Readline library does not have a full set of `vi' editing
1148 functions, it does contain enough to allow simple editing of the line.
1149 The Readline `vi' mode behaves as specified in the POSIX 1003.2
1152 In order to switch interactively between `emacs' and `vi' editing
1153 modes, use the command M-C-j (toggle-editing-mode). The Readline
1154 default is `emacs' mode.
1156 When you enter a line in `vi' mode, you are already placed in
1157 `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches
1158 you into `command' mode, where you can edit the text of the line with
1159 the standard `vi' movement keys, move to previous history lines with
1160 `k' and subsequent lines with `j', and so forth.
1166 Node: Command Line Editing
\7f1617
1167 Node: Introduction and Notation
\7f2231
1168 Node: Readline Interaction
\7f3850
1169 Node: Readline Bare Essentials
\7f5044
1170 Node: Readline Movement Commands
\7f6826
1171 Node: Readline Killing Commands
\7f7784
1172 Node: Readline Arguments
\7f9691
1173 Node: Searching
\7f10667
1174 Node: Readline Init File
\7f12511
1175 Node: Readline Init File Syntax
\7f13573
1176 Node: Conditional Init Constructs
\7f22839
1177 Node: Sample Init File
\7f25279
1178 Node: Bindable Readline Commands
\7f28450
1179 Node: Commands For Moving
\7f29495
1180 Node: Commands For History
\7f30345
1181 Node: Commands For Text
\7f33063
1182 Node: Commands For Killing
\7f35067
1183 Node: Numeric Arguments
\7f37035
1184 Node: Commands For Completion
\7f38163
1185 Node: Keyboard Macros
\7f39912
1186 Node: Miscellaneous Commands
\7f40472
1187 Node: Readline vi Mode
\7f43277