📄 rluser.texinfo
字号:
@item @kbd{\"}@key{"}@item @kbd{\'}@key{'}@end tableWhen entering the text of a macro, single or double quotes shouldbe used to indicate a macro definition. Unquoted textis assumed to be a function name. Backslashwill quote any character in the macro text, including @key{"}and @key{'}.For example, the following binding will make @kbd{C-x \}insert a single @key{\} into the line:@example"\C-x\\": "\\"@end example@end table@end table@node Conditional Init Constructs@subsection Conditional Init ConstructsReadline implements a facility similar in spirit to the conditionalcompilation features of the C preprocessor which allows keybindings and variable settings to be performed as the resultof tests. There are three parser directives used.@ftable @code@item $ifThe @code{$if} construct allows bindings to be made based on theediting mode, the terminal being used, or the application usingReadline. The text of the test extends to the end of the line;no characters are required to isolate it.@table @code@item modeThe @code{mode=} form of the @code{$if} directive is used to testwhether Readline is in @code{emacs} or @code{vi} mode.This may be used in conjunctionwith the @samp{set keymap} command, for instance, to set bindings inthe @code{emacs-standard} and @code{emacs-ctlx} keymaps only ifReadline is starting out in @code{emacs} mode.@item termThe @code{term=} form may be used to include terminal-specifickey bindings, perhaps to bind the key sequences output by theterminal's function keys. The word on the right side of the@samp{=} is tested against the full name of the terminal and theportion of the terminal name before the first @samp{-}. Thisallows @var{sun} to match both @var{sun} and @var{sun-cmd},for instance.@item applicationThe @var{application} construct is used to includeapplication-specific settings. Each program using the Readlinelibrary sets the @var{application name}, and you can test for it. This could be used to bind key sequences to functions useful fora specific program. For instance, the following command adds akey sequence that quotes the current or previous word in Bash:@example$if bash# Quote the current or previous word"\C-xq": "\eb\"\ef\""$endif@end example@end table@item $endifThis command, as you saw in the previous example, terminates an@code{$if} command.@item $elseCommands in this branch of the @code{$if} directive are executed ifthe test fails.@end ftable@node Bindable Readline Commands@section Bindable Readline Commands@menu* Commands For Moving:: Moving about the line.* Commands For History:: Getting at previous lines.* Commands For Text:: Commands for changing text.* Commands For Killing:: Commands for killing and yanking.* Numeric Arguments:: Specifying numeric arguments, repeat counts.* Commands For Completion:: Getting Readline to do the typing for you.* Keyboard Macros:: Saving and re-executing typed characters* Miscellaneous Commands:: Other miscellaneous commands.@end menu@node Commands For Moving@subsection Commands For Moving@ftable @code@item beginning-of-line (C-a)Move to the start of the current line.@item end-of-line (C-e)Move to the end of the line.@item forward-char (C-f)Move forward a character.@item backward-char (C-b)Move back a character.@item forward-word (M-f)Move forward to the end of the next word. Words are composed ofletters and digits.@item backward-word (M-b)Move back to the start of this, or the previous, word. Words arecomposed of letters and digits.@item clear-screen (C-l)Clear the screen and redraw the current line,leaving the current line at the top of the screen.@item redraw-current-line ()Refresh the current line. By default, this is unbound.@end ftable@node Commands For History@subsection Commands For Manipulating The History@ftable @code@item accept-line (Newline, Return)@ifset BashFeaturesAccept the line regardless of where the cursor is. If this line isnon-empty, add it to the history list according to the setting ofthe @code{HISTCONTROL} variable. If this line was a historyline, then restore the history line to its original state.@end ifset@ifclear BashFeaturesAccept the line regardless of where the cursor is. If this line isnon-empty, add it to the history list. If this line was a historyline, then restore the history line to its original state.@end ifclear@item previous-history (C-p)Move `up' through the history list.@item next-history (C-n)Move `down' through the history list.@item beginning-of-history (M-<)Move to the first line in the history.@item end-of-history (M->)Move to the end of the input history, i.e., the line you are entering.@item reverse-search-history (C-r)Search backward starting at the current line and moving `up' throughthe history as necessary. This is an incremental search.@item forward-search-history (C-s)Search forward starting at the current line and moving `down' throughthe the history as necessary. This is an incremental search.@item non-incremental-reverse-search-history (M-p)Search backward starting at the current line and moving `up'through the history as necessary using a non-incremental searchfor a string supplied by the user.@item non-incremental-forward-search-history (M-n)Search forward starting at the current line and moving `down'through the the history as necessary using a non-incremental searchfor a string supplied by the user.@item history-search-forward ()Search forward through the history for the string of charactersbetween the start of the current line and the current point. Thisis a non-incremental search. By default, this command is unbound.@item history-search-backward ()Search backward through the history for the string of charactersbetween the start of the current line and the current point. Thisis a non-incremental search. By default, this command is unbound.@item yank-nth-arg (M-C-y)Insert the first argument to the previous command (usuallythe second word on the previous line). With an argument @var{n},insert the @var{n}th word from the previous command (the wordsin the previous command begin with word 0). A negative argumentinserts the @var{n}th word from the end of the previous command.@item yank-last-arg (M-., M-_)Insert last argument to the previous command (the last word on theprevious line). With anargument, behave exactly like @code{yank-nth-arg}.@end ftable@node Commands For Text@subsection Commands For Changing Text@ftable @code@item delete-char (C-d)Delete the character under the cursor. If the cursor is at thebeginning of the line, there are no characters in the line, andthe last character typed was not C-d, then return EOF.@item backward-delete-char (Rubout)Delete the character behind the cursor. A numeric arg says to killthe characters instead of deleting them.@item quoted-insert (C-q, C-v)Add the next character that you type to the line verbatim. This ishow to insert key sequences like @key{C-q}, for example.@item tab-insert (M-TAB)Insert a tab character.@item self-insert (a, b, A, 1, !, ...)Insert yourself.@item transpose-chars (C-t)Drag the character before the cursor forward overthe character at the cursor, moving thecursor forward as well. If the insertion pointis at the end of the line, then thistransposes the last two characters of the line.Negative argumentss don't work.@item transpose-words (M-t)Drag the word behind the cursor past the word in front of the cursormoving the cursor over that word as well.@item upcase-word (M-u)Uppercase the current (or following) word. With a negative argument,do the previous word, but do not move the cursor.@item downcase-word (M-l)Lowercase the current (or following) word. With a negative argument,do the previous word, but do not move the cursor.@item capitalize-word (M-c)Capitalize the current (or following) word. With a negative argument,do the previous word, but do not move the cursor.@end ftable@node Commands For Killing@subsection Killing And Yanking@ftable @code@item kill-line (C-k)Kill the text from the current cursor position to the end of the line.@item backward-kill-line (C-x Rubout)Kill backward to the beginning of the line.@item unix-line-discard (C-u)Kill backward from the cursor to the beginning of the current line.Save the killed text on the kill-ring.@item kill-whole-line ()Kill all characters on the current line, no matter where thecursor is. By default, this is unbound.@item kill-word (M-d)Kill from the cursor to the end of the current word, or if betweenwords, to the end of the next word. Word boundaries are the sameas @code{forward-word}.@item backward-kill-word (M-DEL)Kill the word behind the cursor. Word boundaries are the sameas @code{backward-word}.@item unix-word-rubout (C-w)Kill the word behind the cursor, using white space as a wordboundary. The killed text is saved on the kill-ring.@item delete-horizontal-space ()Delete all spaces and tabs around point. By default, this is unbound.@item yank (C-y)Yank the top of the kill ring into the buffer at the currentcursor position.@item yank-pop (M-y)Rotate the kill-ring, and yank the new top. You can only do this ifthe prior command is yank or yank-pop.@end ftable@node Numeric Arguments@subsection Specifying Numeric Arguments@ftable @code@item digit-argument (M-0, M-1, ... M--)Add this digit to the argument already accumulating, or start a newargument. M-- starts a negative argument.@item universal-argument ()Each time this is executed, the argument count is multiplied by four.The argument count is initially one, so executing this function thefirst time makes the argument count four. By default, this is notbound to a key.@end ftable@node Commands For Completion@subsection Letting Readline Type For You@ftable @code@item complete (TAB)Attempt to do completion on the text before the cursor. This isapplication-specific. Generally, if you are typing a filenameargument, you can do filename completion; if you are typing a command,you can do command completion, if you are typing in a symbol to GDB, youcan do symbol name completion, if you are typing in a variable to Bash,you can do variable name completion, and so on.@ifset BashFeaturesSee the Bash manual page for a complete list of available completionfunctions.@end ifset@item possible-completions (M-?)List the possible completions of the text before the cursor.@item insert-completions ()Insert all completions of the text before point that would havebeen generated by @code{possible-completions}. By default, thisis not bound to a key.@end ftable@node Keyboard Macros@subsection Keyboard Macros@ftable @code@item start-kbd-macro (C-x ()Begin saving the characters typed into the current keyboard macro.@item end-kbd-macro (C-x ))Stop saving the characters typed into the current keyboard macroand save the definition.@item call-last-kbd-macro (C-x e)Re-execute the last keyboard macro defined, by making the charactersin the macro appear as if typed at the keyboard.@end ftable@node Miscellaneous Commands@subsection Some Miscellaneous Commands@ftable @code@item re-read-init-file (C-x C-r)Read in the contents of your init file, and incorporateany bindings or variable assignments found there.@item abort (C-g)Abort the current editing command andring the terminal's bell (subject to the setting of@code{bell-style}).@item do-uppercase-version (M-a, M-b, ...)Run the command that is bound to the corresoponding uppercasecharacter.@item prefix-meta (ESC)Make the next character that you type be metafied. This is for peoplewithout a meta key. Typing @samp{ESC f} is equivalent to typing@samp{M-f}.@item undo (C-_, C-x C-u)Incremental undo, separately remembered for each line.@item revert-line (M-r)Undo all changes made to this line. This is like typing the @code{undo}command enough times to get back to the beginning.@item tilde-expand (M-~)Perform tilde expansion on the current word.@item dump-functions ()Print all of the functions and their key bindings to thereadline output stream. If a numeric argument is supplied,the output is formatted in such a way that it can be made partof an @var{inputrc} file.@ifset BashFeatures@item display-shell-version (C-x C-v)Display version information about the current instance of Bash.@item shell-expand-line (M-C-e)Expand the line the way the shell does when it reads it. Thisperforms alias and history expansion as well as all of the shellword expansions.@item history-expand-line (M-^)Perform history expansion on the current line.@item insert-last-argument (M-., M-_)A synonym for @code{yank-last-arg}.@item operate-and-get-next (C-o)Accept the current line for execution and fetch the next linerelative to the current line from the history for editing. Anyargument is ignored.@item emacs-editing-mode (C-e)When in @code{vi} editing mode, this causes a switch back toemacs editing mode, as if the command @code{set -o emacs} hadbeen executed.@end ifset@end ftable@node Readline vi Mode@section Readline vi ModeWhile the Readline library does not have a full set of @code{vi}editing functions, it does contain enough to allow simple editingof the line. The Readline @code{vi} mode behaves as specified inthe Posix 1003.2 standard.@ifset BashFeaturesIn order to switch interactively between @code{Emacs} and @code{Vi}editing modes, use the @code{set -o emacs} and @code{set -o vi}commands (@pxref{The Set Builtin}).@end ifset@ifclear BashFeaturesIn order to switch interactively between @code{Emacs} and @code{Vi}editing modes, use the command M-C-j (toggle-editing-mode).@end ifclearThe Readline default is @code{emacs} mode.When you enter a line in @code{vi} mode, you are already placed in`insertion' mode, as if you had typed an @samp{i}. Pressing @key{ESC}switches you into `command' mode, where you can edit the text of theline with the standard @code{vi} movement keys, move to previoushistory lines with @samp{k}, and following lines with @samp{j}, andso forth.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -