summaryrefslogtreecommitdiff
path: root/doc/readline.info
diff options
context:
space:
mode:
Diffstat (limited to 'doc/readline.info')
-rw-r--r--doc/readline.info316
1 files changed, 192 insertions, 124 deletions
diff --git a/doc/readline.info b/doc/readline.info
index 1aa2848..ae6767f 100644
--- a/doc/readline.info
+++ b/doc/readline.info
@@ -1,4 +1,4 @@
-This is Info file readline.info, produced by Makeinfo version 1.67 from
+This is Info file readline.info, produced by Makeinfo version 1.68 from
the input file /usr/homes/chet/src/bash/readline-src/doc/rlman.texinfo.
INFO-DIR-SECTION Libraries
@@ -76,10 +76,18 @@ keystrokes.
produced when the <k> key is pressed while the Control key is depressed.
The text <M-k> is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the <k>
-key is pressed. If you do not have a meta key, the identical keystroke
-can be generated by typing <ESC> first, and then typing <k>. Either
-process is known as "metafying" the <k> key.
+produced when the Meta key (if you have one) is depressed, and the <k>
+key is pressed. The Meta key is labeled <ALT> on many keyboards. On
+keyboards with two keys labeled <ALT> (usually to either side of the
+space bar), the <ALT> on the left side is generally set to work as a
+Meta key. The <ALT> key on the right may also be configured to work as
+a Meta key or may be configured as some other modifier, such as a
+Compose key for typing accented characters.
+
+ If you do not have a Meta or <ALT> key, or another key working as a
+Meta key, the identical keystroke can be generated by typing <ESC>
+first, and then typing <k>. Either process is known as "metafying" the
+<k> key.
The text <M-C-k> is read as `Meta-Control-k' and describes the
character produced by "metafying" <C-k>.
@@ -87,7 +95,9 @@ character produced by "metafying" <C-k>.
In addition, several keys have their own names. Specifically,
<DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
when seen in this text, or in an init file (*note Readline Init
-File::.).
+File::.). If your keyboard lacks a <LFD> key, typing <C-j> will
+produce the desired character. The <RET> key may be labeled <Return>
+or <Enter> on some keyboards.

File: readline.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
@@ -125,18 +135,17 @@ typed character appears where the cursor was, and then the cursor moves
one space to the right. If you mistype a character, you can use your
erase character to back up and delete the mistyped character.
- Sometimes you may miss typing a character that you wanted to type,
-and not notice your error until you have typed several other
-characters. In that case, you can type <C-b> to move the cursor to the
-left, and then correct your mistake. Afterwards, you can move the
-cursor to the right with <C-f>.
+ Sometimes you may mistype a character, and not notice the error
+until you have typed several other characters. In that case, you can
+type <C-b> to move the cursor to the left, and then correct your
+mistake. Afterwards, you can move the cursor to the right with <C-f>.
When you add text in the middle of a line, you will notice that
characters to the right of the cursor are `pushed over' to make room
for the text that you have inserted. Likewise, when you delete text
behind the cursor, characters to the right of the cursor are `pulled
back' to fill in the blank space created by the removal of the text. A
-list of the basic bare essentials for editing the text of an input line
+list of the bare essentials for editing the text of an input line
follows.
<C-b>
@@ -145,7 +154,7 @@ follows.
<C-f>
Move forward one character.
-<DEL>
+<DEL> or <Backspace>
Delete the character to the left of the cursor.
<C-d>
@@ -154,21 +163,25 @@ follows.
Printing characters
Insert the character into the line at the cursor.
-<C-_>
+<C-_> or <C-x C-u>
Undo the last editing command. You can undo all the way back to an
empty line.
+(Depending on your configuration, the <Backspace> key be set to delete
+the character to the left of the cursor and the <DEL> key set to delete
+the character underneath the cursor, like <C-d>, rather than the
+character to the left of the cursor.)
+

File: readline.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
Readline Movement Commands
--------------------------
- The above table describes the most basic possible keystrokes that
-you need in order to do editing of the input line. For your
-convenience, many other commands have been added in addition to <C-b>,
-<C-f>, <C-d>, and <DEL>. Here are some commands for moving more rapidly
-about the line.
+ The above table describes the most basic keystrokes that you need in
+order to do editing of the input line. For your convenience, many
+other commands have been added in addition to <C-b>, <C-f>, <C-d>, and
+<DEL>. Here are some commands for moving more rapidly about the line.
<C-a>
Move to the start of the line.
@@ -198,9 +211,12 @@ Readline Killing Commands
"Killing" text means to delete the text from the line, but to save
it away for later use, usually by "yanking" (re-inserting) it back into
-the line. If the description for a command says that it `kills' text,
-then you can be sure that you can get the text back in a different (or
-the same) place later.
+the line. (`Cut' and `paste' are more recent jargon for `kill' and
+`yank'.)
+
+ If the description for a command says that it `kills' text, then you
+can be sure that you can get the text back in a different (or the same)
+place later.
When you use a kill command, the text is saved in a "kill-ring".
Any number of consecutive kills save all of the killed text together, so
@@ -215,12 +231,14 @@ available to be yanked back later, when you are typing another line.
line.
<M-d>
- Kill from the cursor to the end of the current word, or if between
- words, to the end of the next word.
+ Kill from the cursor to the end of the current word, or, if between
+ words, to the end of the next word. Word boundaries are the same
+ as those used by <M-f>.
<M-DEL>
- Kill from the cursor the start of the previous word, or if between
- words, to the start of the previous word.
+ Kill from the cursor the start of the previous word, or, if between
+ words, to the start of the previous word. Word boundaries are the
+ same as those used by <M-b>.
<C-w>
Kill from the cursor to the previous whitespace. This is
@@ -252,7 +270,7 @@ start of the line, you might type `M-- C-k'.
The general way to pass numeric arguments to a command is to type
meta digits before the command. If the first `digit' typed is a minus
-sign (<->), then the sign of the argument will be negative. Once you
+sign (`-'), then the sign of the argument will be negative. Once you
have typed one meta digit to get the argument started, you can type the
remainder of the digits, and then the command. For example, to give
the <C-d> command an argument of 10, you could type `M-1 0 C-d'.
@@ -271,19 +289,23 @@ INCREMENTAL and NON-INCREMENTAL.
search string. As each character of the search string is typed,
Readline displays the next entry from the history matching the string
typed so far. An incremental search requires only as many characters
-as needed to find the desired history entry. The characters present in
-the value of the ISEARCH-TERMINATORS variable are used to terminate an
-incremental search. If that variable has not been assigned a value,
-the <ESC> and <C-J> characters will terminate an incremental search.
-<C-g> will abort an incremental search and restore the original line.
-When the search is terminated, the history entry containing the search
-string becomes the current line. To find other matching entries in the
-history list, type <C-s> or <C-r> as appropriate. This will search
-backward or forward in the history for the next entry matching the
-search string typed so far. Any other key sequence bound to a Readline
-command will terminate the search and execute that command. For
-instance, a <RET> will terminate the search and accept the line,
-thereby executing the command from the history list.
+as needed to find the desired history entry. To search backward in the
+history for a particular string, type <C-r>. Typing <C-s> searches
+forward through the history. The characters present in the value of
+the `isearch-terminators' variable are used to terminate an incremental
+search. If that variable has not been assigned a value, the <ESC> and
+<C-J> characters will terminate an incremental search. <C-g> will
+abort an incremental search and restore the original line. When the
+search is terminated, the history entry containing the search string
+becomes the current line.
+
+ To find other matching entries in the history list, type <C-r> or
+<C-s> as appropriate. This will search backward or forward in the
+history for the next entry matching the search string typed so far.
+Any other key sequence bound to a Readline command will terminate the
+search and execute that command. For instance, a <RET> will terminate
+the search and accept the line, thereby executing the command from the
+history list.
Non-incremental searches read the entire search string before
starting to search for matching history lines. The search string may be
@@ -295,12 +317,13 @@ File: readline.info, Node: Readline Init File, Next: Bindable Readline Command
Readline Init File
==================
- Although the Readline library comes with a set of `emacs'-like
+ Although the Readline library comes with a set of Emacs-like
keybindings installed by default, it is possible to use a different set
of keybindings. Any user can customize programs that use Readline by
-putting commands in an "inputrc" file in his home directory. The name
-of this file is taken from the value of the environment variable
-`INPUTRC'. If that variable is unset, the default is `~/.inputrc'.
+putting commands in an "inputrc" file, conventionally in his home
+directory. The name of this file is taken from the value of the
+environment variable `INPUTRC'. If that variable is unset, the default
+is `~/.inputrc'.
When a program which uses the Readline library starts up, the init
file is read, and the key bindings are set.
@@ -367,7 +390,7 @@ Variable Settings
`convert-meta'
If set to `on', Readline will convert characters with the
eighth bit set to an ASCII key sequence by stripping the
- eighth bit and prepending an <ESC> character, converting them
+ eighth bit and prefixing an <ESC> character, converting them
to a meta-prefixed key sequence. The default value is `on'.
`disable-completion'
@@ -452,7 +475,7 @@ Variable Settings
Key Bindings
The syntax for controlling key bindings in the init file is
- simple. First you have to know the name of the command that you
+ simple. First you need to find the name of the command that you
want to change. The following sections contain tables of the
command name, the default keybinding, if any, and a short
description of what the command does.
@@ -508,10 +531,10 @@ Key Bindings
backslash
`\"'
- <">
+ <">, a double quotation mark
`\''
- <'>
+ <'>, a single quote or apostrophe
In addition to the GNU Emacs style escape sequences, a second set
of backslash escapes is available:
@@ -541,11 +564,11 @@ Key Bindings
vertical tab
`\NNN'
- the character whose ASCII code is the octal value NNN (one to
- three digits)
+ the character whose `ASCII' code is the octal value NNN (one
+ to three digits)
`\xNNN'
- the character whose ASCII code is the hexadecimal value NNN
+ the character whose `ASCII' code is the hexadecimal value NNN
(one to three digits)
When entering the text of a macro, single or double quotes must be
@@ -744,6 +767,12 @@ Bindable Readline Commands
This section describes Readline commands that may be bound to key
sequences.
+ Command names without an accompanying key sequence are unbound by
+default. In the following descriptions, POINT refers to the current
+cursor position, and MARK refers to a cursor position saved by the
+`set-mark' command. The text between the point and mark is referred to
+as the REGION.
+

File: readline.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
@@ -767,7 +796,7 @@ Commands For Moving
letters and digits.
`backward-word (M-b)'
- Move back to the start of this, or the previous, word. Words are
+ Move back to the start of the current or previous word. Words are
composed of letters and digits.
`clear-screen (C-l)'
@@ -822,9 +851,8 @@ Commands For Manipulating The History
`history-search-forward ()'
Search forward through the history for the string of characters
- between the start of the current line and the current cursor
- position (the POINT). This is a non-incremental search. By
- default, this command is unbound.
+ between the start of the current line and the point. This is a
+ non-incremental search. By default, this command is unbound.
`history-search-backward ()'
Search backward through the history for the string of characters
@@ -880,11 +908,11 @@ Commands For Changing Text
Drag the character before the cursor forward over the character at
the cursor, moving the cursor forward as well. If the insertion
point is at the end of the line, then this transposes the last two
- characters of the line. Negative arguments don't work.
+ characters of the line. Negative arguments have no effect.
`transpose-words (M-t)'
- Drag the word behind the cursor past the word in front of the
- cursor moving the cursor over that word as well.
+ Drag the word before point past the word after point, moving point
+ past that word as well.
`upcase-word (M-u)'
Uppercase the current (or following) word. With a negative
@@ -905,41 +933,38 @@ Killing And Yanking
-------------------
`kill-line (C-k)'
- Kill the text from the current cursor position to the end of the
- line.
+ Kill the text from point to the end of the line.
`backward-kill-line (C-x Rubout)'
Kill backward to the beginning of the line.
`unix-line-discard (C-u)'
Kill backward from the cursor to the beginning of the current line.
- The killed text is saved on the kill-ring.
`kill-whole-line ()'
- Kill all characters on the current line, no matter where the
- cursor is. By default, this is unbound.
+ Kill all characters on the current line, no matter point is. By
+ default, this is unbound.
`kill-word (M-d)'
- Kill from the cursor to the end of the current word, or if between
+ Kill from point to the end of the current word, or if between
words, to the end of the next word. Word boundaries are the same
as `forward-word'.
`backward-kill-word (M-DEL)'
- Kill the word behind the cursor. Word boundaries are the same as
+ Kill the word behind point. Word boundaries are the same as
`backward-word'.
`unix-word-rubout (C-w)'
- Kill the word behind the cursor, using white space as a word
- boundary. The killed text is saved on the kill-ring.
+ Kill the word behind point, using white space as a word boundary.
+ The killed text is saved on the kill-ring.
`delete-horizontal-space ()'
Delete all spaces and tabs around point. By default, this is
unbound.
`kill-region ()'
- Kill the text between the point and the *mark* (saved cursor
- position). This text is referred to as the REGION. By default,
- this command is unbound.
+ Kill the text in the current region. By default, this command is
+ unbound.
`copy-region-as-kill ()'
Copy the text in the region to the kill buffer, so it can be yanked
@@ -1049,7 +1074,7 @@ Some Miscellaneous Commands
---------------------------
`re-read-init-file (C-x C-r)'
- Read in the contents of the inputrc file, and incorporate any
+ Read in the contents of the INPUTRC file, and incorporate any
bindings or variable assignments found there.
`abort (C-g)'
@@ -1283,6 +1308,13 @@ This section describes the various functions and variables defined
within the Readline library which allow a user program to add
customized functionality to Readline.
+ Before declaring any functions that customize Readline's behavior, or
+using any functionality Readline provides in other code, an application
+writer should include the file `<readline/readline.h>' in any file that
+uses Readline's features. Since some of the definitions in
+`readline.h' use the `stdio' library, the file `<stdio.h>' should be
+included before `readline.h'.
+
* Menu:
* The Function Type:: C declarations to make code readable.
@@ -1356,7 +1388,9 @@ Readline Variables
- Variable: char * rl_line_buffer
This is the line gathered so far. You are welcome to modify the
- contents of the line, but see *Note Allowing Undoing::.
+ contents of the line, but see *Note Allowing Undoing::. The
+ function `rl_extend_line_buffer' is available to increase the
+ memory allocated to `rl_line_buffer'.
- Variable: int rl_point
The offset of the current cursor position in `rl_line_buffer' (the
@@ -1389,6 +1423,15 @@ Readline Variables
The prompt Readline uses. This is set from the argument to
`readline ()', and should not be assigned to directly.
+ - Variable: int rl_already_prompted
+ If an application wishes to display the prompt itself, rather than
+ have Readline do it the first time `readline()' is called, it
+ should set this variable to a non-zero value after displaying the
+ prompt. The prompt must also be passed as the argument to
+ `readline()' so the redisplay functions can update the display
+ properly. The calling application is responsible for managing the
+ value; Readline never sets it.
+
- Variable: char * rl_library_version
The version number of this revision of the library.
@@ -1546,6 +1589,13 @@ several internal keymaps: `emacs_standard_keymap', `emacs_meta_keymap',
`emacs_standard_keymap' is the default, and the examples in this manual
assume that.
+ Since `readline' installs a set of default key bindings the first
+time it is called, there is always the danger that a custom binding
+installed before the first call to `readline' will be overridden. An
+alternate mechanism is to install custom key bindings in an
+initialization function assigned to the `rl_startup_hook' variable
+(*note Readline Variables::.).
+
These functions manage key bindings.
- Function: int rl_bind_key (int key, Function *function)
@@ -1627,6 +1677,12 @@ functions and the functions invoked by a particular key sequence.
Print the names of all bindable Readline functions to
`rl_outstream'.
+ - Function: char ** rl_funmap_names ()
+ Return a NULL terminated array of known function names. The array
+ is sorted. The array itself is allocated, but not the strings
+ inside. You should free () the array when you done, but not the
+ pointrs.
+

File: readline.info, Node: Allowing Undoing, Next: Redisplay, Prev: Associating Function Names and Bindings, Up: Readline Convenience Functions
@@ -1704,9 +1760,16 @@ Redisplay
Readline thinks the screen display is correct.
- Function: int rl_on_new_line ()
- Tell the update routines that we have moved onto a new (empty)
+ Tell the update functions that we have moved onto a new (empty)
line, usually after ouputting a newline.
+ - Function: int rl_on_new_line_with_prompt ()
+ Tell the update functions that we have moved onto a new line, with
+ RL_PROMPT already displayed. This could be used by applications
+ that want to output the prompt string themselves, but still need
+ Readline to know the prompt string length for redisplay. It
+ should be used after setting RL_ALREADY_PROMPTED.
+
- Function: int rl_reset_line_state ()
Reset the display state to a clean state and redisplay the current
line starting on a new line.
@@ -1759,7 +1822,7 @@ Utility Functions
- Function: int rl_read_key ()
Return the next character available. This handles input inserted
into the input stream via PENDING INPUT (*note Readline
- Variables::.) and `rl_stuff_char ()', macros, and characters read
+ Variables::.) and `rl_stuff_char ()', macros, and characters read
from the keyboard.
- Function: int rl_getc (FILE *)
@@ -1770,7 +1833,7 @@ Utility Functions
Readline attempts to read characters from the terminal with
`rl_read_key ()'.
- - Function: rl_extend_line_buffer (int len)
+ - Function: int rl_extend_line_buffer (int len)
Ensure that `rl_line_buffer' has enough space to hold LEN
characters, possibly reallocating it if necessary.
@@ -1779,7 +1842,9 @@ Utility Functions
- Function: int rl_reset_terminal (char *terminal_name)
Reinitialize Readline's idea of the terminal settings using
- TERMINAL_NAME as the terminal type (e.g., `vt100').
+ TERMINAL_NAME as the terminal type (e.g., `vt100'). If
+ TERMINAL_NAME is NULL, the value of the `TERM' environment
+ variable is used.
- Function: int alphabetic (int c)
Return 1 if C is an alphabetic character.
@@ -2171,7 +2236,7 @@ Completion Variables
- Variable: Function * rl_completion_entry_function
A pointer to the generator function for `completion_matches ()'.
- `NULL' means to use `filename_entry_function ()', the default
+ `NULL' means to use `filename_completion_function ()', the default
filename completer.
- Variable: CPPFunction * rl_attempted_completion_function
@@ -2779,7 +2844,6 @@ Function and Variable Index
* Menu:
-* (: Utility Functions.
* abort (C-g): Miscellaneous Commands.
* accept-line (Newline, Return): Commands For History.
* alphabetic: Utility Functions.
@@ -2862,6 +2926,7 @@ Function and Variable Index
* revert-line (M-r): Miscellaneous Commands.
* rl_add_defun: Function Naming.
* rl_add_undo: Allowing Undoing.
+* rl_already_prompted: Readline Variables.
* rl_attempted_completion_function: Completion Variables.
* rl_basic_quote_characters: Completion Variables.
* rl_basic_word_break_characters: Completion Variables.
@@ -2885,8 +2950,8 @@ Function and Variable Index
* rl_completer_word_break_characters: Completion Variables.
* rl_completion_append_character: Completion Variables.
* rl_completion_display_matches_hook: Completion Variables.
-* rl_completion_entry_function <1>: How Completing Works.
-* rl_completion_entry_function: Completion Variables.
+* rl_completion_entry_function <1>: Completion Variables.
+* rl_completion_entry_function: How Completing Works.
* rl_completion_query_items: Completion Variables.
* rl_copy_keymap: Keymaps.
* rl_copy_text: Modifying Text.
@@ -2901,6 +2966,7 @@ Function and Variable Index
* rl_erase_empty_line: Readline Variables.
* rl_event_hook: Readline Variables.
* rl_executing_keymap: Readline Variables.
+* rl_extend_line_buffer: Utility Functions.
* rl_filename_completion_desired: Completion Variables.
* rl_filename_dequoting_function: Completion Variables.
* rl_filename_quote_characters: Completion Variables.
@@ -2910,6 +2976,7 @@ Function and Variable Index
* rl_free_line_state: Readline Signal Handling.
* rl_function_dumper: Associating Function Names and Bindings.
* rl_function_of_keyseq: Associating Function Names and Bindings.
+* rl_funmap_names: Associating Function Names and Bindings.
* rl_generic_bind: Binding Keys.
* rl_get_keymap: Keymaps.
* rl_get_keymap_by_name: Keymaps.
@@ -2936,6 +3003,7 @@ Function and Variable Index
* rl_modifying: Allowing Undoing.
* rl_named_function: Associating Function Names and Bindings.
* rl_on_new_line: Redisplay.
+* rl_on_new_line_with_prompt: Redisplay.
* rl_outstream: Readline Variables.
* rl_parse_and_bind: Binding Keys.
* rl_pending_input: Readline Variables.
@@ -2991,49 +3059,49 @@ Tag Table:
Node: Top1190
Node: Command Line Editing1789
Node: Introduction and Notation2440
-Node: Readline Interaction3479
-Node: Readline Bare Essentials4672
-Node: Readline Movement Commands6213
-Node: Readline Killing Commands7179
-Node: Readline Arguments8895
-Node: Searching9870
-Node: Readline Init File11583
-Node: Readline Init File Syntax12630
-Node: Conditional Init Constructs21837
-Node: Sample Init File24276
-Node: Bindable Readline Commands27446
-Node: Commands For Moving28197
-Node: Commands For History29045
-Node: Commands For Text31797
-Node: Commands For Killing33816
-Node: Numeric Arguments35966
-Node: Commands For Completion37093
-Node: Keyboard Macros38841
-Node: Miscellaneous Commands39400
-Node: Readline vi Mode42204
-Node: Programming with GNU Readline43974
-Node: Basic Behavior44942
-Node: Custom Functions48268
-Node: The Function Type48869
-Node: Function Writing49714
-Node: Readline Variables50798
-Node: Readline Convenience Functions54407
-Node: Function Naming55145
-Node: Keymaps56373
-Node: Binding Keys58087
-Node: Associating Function Names and Bindings60295
-Node: Allowing Undoing61873
-Node: Redisplay64458
-Node: Modifying Text65853
-Node: Utility Functions66764
-Node: Alternate Interface69448
-Node: Readline Signal Handling72742
-Node: Custom Completers77788
-Node: How Completing Works78503
-Node: Completion Functions81499
-Node: Completion Variables84514
-Node: A Short Completion Example92412
-Node: Concept Index104718
-Node: Function and Variable Index105472
+Node: Readline Interaction4058
+Node: Readline Bare Essentials5251
+Node: Readline Movement Commands7032
+Node: Readline Killing Commands7989
+Node: Readline Arguments9895
+Node: Searching10870
+Node: Readline Init File12713
+Node: Readline Init File Syntax13774
+Node: Conditional Init Constructs23039
+Node: Sample Init File25478
+Node: Bindable Readline Commands28648
+Node: Commands For Moving29692
+Node: Commands For History30541
+Node: Commands For Text33258
+Node: Commands For Killing35261
+Node: Numeric Arguments37228
+Node: Commands For Completion38355
+Node: Keyboard Macros40103
+Node: Miscellaneous Commands40662
+Node: Readline vi Mode43466
+Node: Programming with GNU Readline45236
+Node: Basic Behavior46204
+Node: Custom Functions49530
+Node: The Function Type50508
+Node: Function Writing51353
+Node: Readline Variables52437
+Node: Readline Convenience Functions56649
+Node: Function Naming57387
+Node: Keymaps58615
+Node: Binding Keys60329
+Node: Associating Function Names and Bindings62903
+Node: Allowing Undoing64746
+Node: Redisplay67331
+Node: Modifying Text69108
+Node: Utility Functions70019
+Node: Alternate Interface72799
+Node: Readline Signal Handling76093
+Node: Custom Completers81139
+Node: How Completing Works81854
+Node: Completion Functions84850
+Node: Completion Variables87865
+Node: A Short Completion Example95768
+Node: Concept Index108074
+Node: Function and Variable Index108828

End Tag Table