1.4.1 Commands For Moving
- Move to the start of the current line.
- Move to the end of the line.
- Move forward a character.
- Move back a character.
- Move forward to the end of the next word. Words are composed of letters and digits.
- Move back to the start of the current or previous word. Words are composed of letters and digits.
- Clear the screen and redraw the current line, leaving the current line at the top of the screen.
- Refresh the current line. By default, this is unbound.
beginning-of-line (C-a)
end-of-line (C-e)
forward-char (C-f)
backward-char (C-b)
forward-word (M-f)
backward-word (M-b)
clear-screen (C-l)
redraw-current-line ()
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.2 Commands For Manipulating The History
- Accept the line regardless of where the cursor is. If this line is non-empty, it may be added to the history list for future recall with
. If this line is a modified history line, the history line is restored to its original state.add_history()
- Move `back' through the history list, fetching the previous command.
- Move `forward' through the history list, fetching the next command.
- Move to the first line in the history.
- Move to the end of the input history, i.e., the line currently being entered.
- Search backward starting at the current line and moving `up' through the history as necessary. This is an incremental search.
- Search forward starting at the current line and moving `down' through the the history as necessary. This is an incremental search.
- Search backward starting at the current line and moving `up' through the history as necessary using a non-incremental search for a string supplied by the user.
- Search forward starting at the current line and moving `down' through the the history as necessary using a non-incremental search for a string supplied by the user.
- Search forward through the history for the string of characters between the start of the current line and the point. The search string must match at the beginning of a history line. This is a non-incremental search. By default, this command is unbound.
- Search backward through the history for the string of characters between the start of the current line and the point. The search string must match at the beginning of a history line. This is a non-incremental search. By default, this command is unbound.
- Search forward through the history for the string of characters between the start of the current line and the point. The search string may match anywhere in a history line. This is a non-incremental search. By default, this command is unbound.
- Search backward through the history for the string of characters between the start of the current line and the point. The search string may match anywhere in a history line. This is a non-incremental search. By default, this command is unbound.
- Insert the first argument to the previous command (usually the second word on the previous line) at point. With an argument n, insert the nth word from the previous command (the words in the previous command begin with word 0). A negative argument inserts the nth word from the end of the previous command. Once the argument n is computed, the argument is extracted as if the `!n' history expansion had been specified.
- Insert last argument to the previous command (the last word of the previous history entry). With a numeric argument, behave exactly like
. Successive calls toyank-nth-arg
move back through the history list, inserting the last word (or the word specified by the argument to the first call) of each line in turn. Any numeric argument supplied to these successive calls determines the direction to move through the history. A negative argument switches the direction through the history (back or forward). The history expansion facilities are used to extract the last argument, as if the `!$' history expansion had been specified.yank-last-arg
accept-line (Newline or Return)
previous-history (C-p)
next-history (C-n)
beginning-of-history (M-<)
end-of-history (M->)
reverse-search-history (C-r)
forward-search-history (C-s)
non-incremental-reverse-search-history (M-p)
non-incremental-forward-search-history (M-n)
history-search-forward ()
history-search-backward ()
history-substr-search-forward ()
history-substr-search-backward ()
yank-nth-arg (M-C-y)
yank-last-arg (M-. or M-_)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.3 Commands For Changing Text
- The character indicating end-of-file as set, for example, by
. If this character is read when there are no characters on the line, and point is at the beginning of the line, Readline interprets it as the end of input and returns EOF.stty
- Delete the character at point. If this function is bound to the same character as the tty EOF character, as C-d commonly is, see above for the effects.
- Delete the character behind the cursor. A numeric argument means to kill the characters instead of deleting them.
- Delete the character under the cursor, unless the cursor is at the end of the line, in which case the character behind the cursor is deleted. By default, this is not bound to a key.
- Add the next character typed to the line verbatim. This is how to insert key sequences like C-q, for example.
- Insert a tab character.
- Insert yourself.
- 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 have no effect.
- Drag the word before point past the word after point, moving point past that word as well. If the insertion point is at the end of the line, this transposes the last two words on the line.
- Uppercase the current (or following) word. With a negative argument, uppercase the previous word, but do not move the cursor.
- Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but do not move the cursor.
- Capitalize the current (or following) word. With a negative argument, capitalize the previous word, but do not move the cursor.
- Toggle overwrite mode. With an explicit positive numeric argument, switches to overwrite mode. With an explicit non-positive numeric argument, switches to insert mode. This command affects only
mode;emacs
mode does overwrite differently. Each call tovi
readline()
starts in insert mode.
In overwrite mode, characters bound to
replace the text at point rather than pushing the text to the right. Characters bound toself-insert
backward-delete-char
replace the character before point with a space.
By default, this command is unbound.
end-of-file (usually C-d)
delete-char (C-d)
backward-delete-char (Rubout)
forward-backward-delete-char ()
quoted-insert (C-q or C-v)
tab-insert (M-TAB)
self-insert (a, b, A, 1, !, ...)
transpose-chars (C-t)
transpose-words (M-t)
upcase-word (M-u)
downcase-word (M-l)
capitalize-word (M-c)
overwrite-mode ()
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.4 Killing And Yanking
- Kill the text from point to the end of the line.
- Kill backward to the beginning of the line.
- Kill backward from the cursor to the beginning of the current line.
- Kill all characters on the current line, no matter where point is. By default, this is unbound.
- 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
- Kill the word behind point. Word boundaries are the same as
.backward-word
- Kill the word behind point, using white space as a word boundary. The killed text is saved on the kill-ring.
- Kill the word behind point, using white space and the slash character as the word boundaries. The killed text is saved on the kill-ring.
- Delete all spaces and tabs around point. By default, this is unbound.
- Kill the text in the current region. By default, this command is unbound.
- Copy the text in the region to the kill buffer, so it can be yanked right away. By default, this command is unbound.
- Copy the word before point to the kill buffer. The word boundaries are the same as
. By default, this command is unbound.backward-word
- Copy the word following point to the kill buffer. The word boundaries are the same as
. By default, this command is unbound.forward-word
- Yank the top of the kill ring into the buffer at point.
- Rotate the kill-ring, and yank the new top. You can only do this if the prior command is
oryank
.yank-pop
kill-line (C-k)
backward-kill-line (C-x Rubout)
unix-line-discard (C-u)
kill-whole-line ()
kill-word (M-d)
backward-kill-word (M-DEL)
unix-word-rubout (C-w)
unix-filename-rubout ()
delete-horizontal-space ()
kill-region ()
copy-region-as-kill ()
copy-backward-word ()
copy-forward-word ()
yank (C-y)
yank-pop (M-y)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.5 Specifying Numeric Arguments
- Add this digit to the argument already accumulating, or start a new argument. M-- starts a negative argument.
- This is another way to specify an argument. If this command is followed by one or more digits, optionally with a leading minus sign, those digits define the argument. If the command is followed by digits, executing
again ends the numeric argument, but is otherwise ignored. As a special case, if this command is immediately followed by a character that is neither a digit or minus sign, the argument count for the next command is multiplied by four. The argument count is initially one, so executing this function the first time makes the argument count four, a second time makes the argument count sixteen, and so on. By default, this is not bound to a key.universal-argument
digit-argument (M-0, M-1, ... M--)
universal-argument ()
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.6 Letting Readline Type For You
- Attempt to perform completion on the text before point. The actual completion performed is application-specific. The default is filename completion.
- List the possible completions of the text before point. When displaying completions, Readline sets the number of columns used for display to the value of
, the value of the environment variablecompletion-display-width
, or the screen width, in that order.COLUMNS
- Insert all completions of the text before point that would have been generated by
.possible-completions
- Similar to
, but replaces the word to be completed with a single match from the list of possible completions. Repeated execution ofcomplete
steps through the list of possible completions, inserting each match in turn. At the end of the list of completions, the bell is rung (subject to the setting ofmenu-complete
) and the original text is restored. An argument of n moves n positions forward in the list of matches; a negative argument may be used to move backward through the list. This command is intended to be bound to TAB, but is unbound by default.bell-style
- Identical to
, but moves backward through the list of possible completions, as ifmenu-complete
had been given a negative argument.menu-complete
- Deletes the character under the cursor if not at the beginning or end of the line (like
). If at the end of the line, behaves identically todelete-char
. This command is unbound by default.possible-completions
complete (TAB)
possible-completions (M-?)
insert-completions (M-*)
menu-complete ()
menu-complete-backward ()
delete-char-or-list ()
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.7 Keyboard Macros
- Begin saving the characters typed into the current keyboard macro.
- Stop saving the characters typed into the current keyboard macro and save the definition.
- Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard.
- Print the last keboard macro defined in a format suitable for the inputrc file.
start-kbd-macro (C-x ()
end-kbd-macro (C-x ))
call-last-kbd-macro (C-x e)
print-last-kbd-macro ()
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.4.8 Some Miscellaneous Commands
- Read in the contents of the inputrc file, and incorporate any bindings or variable assignments found there.
- Abort the current editing command and ring the terminal's bell (subject to the setting of
).bell-style
- If the metafied character x is lowercase, run the command that is bound to the corresponding uppercase character.
- Metafy the next character typed. This is for keyboards without a meta key. Typing `ESC f' is equivalent to typing M-f.
- Incremental undo, separately remembered for each line.
- Undo all changes made to this line. This is like executing the
command enough times to get back to the beginning.undo
- Perform tilde expansion on the current word.
- Set the mark to the point. If a numeric argument is supplied, the mark is set to that position.
- Swap the point with the mark. The current cursor position is set to the saved position, and the old cursor position is saved as the mark.
- A character is read and point is moved to the next occurrence of that character. A negative count searches for previous occurrences.
- A character is read and point is moved to the previous occurrence of that character. A negative count searches for subsequent occurrences.
- Read enough characters to consume a multi-key sequence such as those defined for keys like Home and End. Such sequences begin with a Control Sequence Indicator (CSI), usually ESC-[. If this sequence is bound to "\e[", keys producing such sequences will have no effect unless explicitly bound to a readline command, instead of inserting stray characters into the editing buffer. This is unbound by default, but usually bound to ESC-[.
- Without a numeric argument, the value of the
variable is inserted at the beginning of the current line. If a numeric argument is supplied, this command acts as a toggle: if the characters at the beginning of the line do not match the value ofcomment-begin
, the value is inserted, otherwise the characters incomment-begin
are deleted from the beginning of the line. In either case, the line is accepted as if a newline had been typed.comment-begin
- Print all of the functions and their key bindings to the Readline output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file. This command is unbound by default.
- Print all of the settable variables and their values to the Readline output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file. This command is unbound by default.
- Print all of the Readline key sequences bound to macros and the strings they output. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an inputrc file. This command is unbound by default.
- When in
command mode, this causes a switch tovi
editing mode.emacs
- When in
editing mode, this causes a switch toemacs
editing mode.vi
re-read-init-file (C-x C-r)
abort (C-g)
do-uppercase-version (M-a, M-b, M-x, ...)
prefix-meta (ESC)
undo (C-_ or C-x C-u)
revert-line (M-r)
tilde-expand (M-~)
set-mark ([email protected])
exchange-point-and-mark (C-x C-x)
character-search (C-])
character-search-backward (M-C-])
skip-csi-sequence ()
insert-comment (M-#)
dump-functions ()
dump-variables ()
dump-macros ()
emacs-editing-mode (C-e)
vi-editing-mode (M-C-j)