📄 rluser.texinfo
字号:
@comment %**start of header (This is for running Texinfo on a region.)@setfilename rluser.info@comment %**end of header (This is for running Texinfo on a region.)@setchapternewpage odd@ignoreThis file documents the end user interface to the GNU command lineediting feautres. It is to be an appendix to manuals for programs whichuse these features. There is a document entitled "readline.texinfo"which contains both end-user and programmer documentation for the GNUReadline Library.Copyright (C) 1988 Free Software Foundation, Inc.Authored by Brian Fox.Permission is granted to process this file through Tex and print theresults, provided the printed document carries copying permission noticeidentical to this one except for the removal of this paragraph (thisparagraph not being relevant to the printed manual).Permission is granted to make and distribute verbatim copies of this manualprovided the copyright notice and this permission notice are preserved onall copies.Permission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided also that theGNU Copyright statement is available to the distributee, and provided thatthe entire resulting derived work is distributed under the terms of apermission notice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the above conditions for modified versions.@end ignore@node Command Line Editing@appendix Command Line EditingThis text describes GNU's command line editing interface.@menu* Introduction and Notation:: Notation used in this text.* Readline Interaction:: The minimum set of commands for editing a line.* Readline Init File:: Customizing Readline from a user's view.@end menu@node Introduction and Notation@section Introduction to Line EditingThe following paragraphs describe the notation we use to representkeystrokes.The text @key{C-k} is read as `Control-K' and describes the characterproduced when the Control key is depressed and the @key{k} key is struck.The text @key{M-k} is read as `Meta-K' and describes the characterproduced when the meta key (if you have one) is depressed, and the @key{k}key is struck. If you do not have a meta key, the identical keystrokecan be generated by typing @key{ESC} @i{first}, and then typing @key{k}.Either process is known as @dfn{metafying} the @key{k} key.The text @key{M-C-k} is read as `Meta-Control-k' and describes thecharacter produced by @dfn{metafying} @key{C-k}.In addition, several keys have their own names. Specifically,@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} allstand for themselves when seen in this text, or in an init file(@pxref{Readline Init File}, for more info).@node Readline Interaction@section Readline Interaction@cindex interaction, readlineOften during an interactive session you type in a long line of text,only to notice that the first word on the line is misspelled. TheReadline library gives you a set of commands for manipulating the textas you type it in, allowing you to just fix your typo, and not forcingyou to retype the majority of the line. Using these editing commands,you move the cursor to the place that needs correction, and delete orinsert the text of the corrections. Then, when you are satisfied withthe line, you simply press @key{RETURN}. You do not have to be at theend of the line to press @key{RETURN}; the entire line is acceptedregardless of the location of the cursor within the line.@menu* Readline Bare Essentials:: The least you need to know about Readline.* Readline Movement Commands:: Moving about the input line.* Readline Killing Commands:: How to delete text, and how to get it back!* Readline Arguments:: Giving numeric arguments to commands.@end menu@node Readline Bare Essentials@subsection Readline Bare EssentialsIn order to enter characters into the line, simply type them. The typedcharacter appears where the cursor was, and then the cursor moves onespace to the right. If you mistype a character, you can use @key{DEL} toback up, and delete the mistyped character.Sometimes you may miss typing a character that you wanted to type, andnot notice your error until you have typed several other characters. Inthat case, you can type @key{C-b} to move the cursor to the left, and thencorrect your mistake. Aftwerwards, you can move the cursor to the rightwith @key{C-f}.When you add text in the middle of a line, you will notice that charactersto the right of the cursor get `pushed over' to make room for the textthat you have inserted. Likewise, when you delete text behind the cursor,characters to the right of the cursor get `pulled back' to fill in theblank space created by the removal of the text. A list of the basic bareessentials for editing the text of an input line follows.@table @asis@item @key{C-b}Move back one character.@item @key{C-f}Move forward one character.@item @key{DEL}Delete the character to the left of the cursor.@item @key{C-d}Delete the character underneath the cursor.@item @w{Printing characters}Insert itself into the line at the cursor.@item @key{C-_}Undo the last thing that you did. You can undo all the way back to anempty line.@end table@node Readline Movement Commands@subsection Readline Movement CommandsThe above table describes the most basic possible keystrokes that you needin order to do editing of the input line. For your convenience, manyother commands have been added in addition to @key{C-b}, @key{C-f},@key{C-d}, and @key{DEL}. Here are some commands for moving more rapidlyabout the line.@table @key@item C-aMove to the start of the line.@item C-eMove to the end of the line.@item M-fMove forward a word.@item M-bMove backward a word.@item C-lClear the screen, reprinting the current line at the top.@end tableNotice how @key{C-f} moves forward a character, while @key{M-f} movesforward a word. It is a loose convention that control keystrokesoperate on characters while meta keystrokes operate on words.@node Readline Killing Commands@subsection Readline Killing Commands@dfn{Killing} text means to delete the text from the line, but to saveit away for later use, usually by @dfn{yanking} it back into the line.If the description for a command says that it `kills' text, then you canbe sure that you can get the text back in a different (or the same)place later.Here is the list of commands for killing text.@table @key@item C-kKill the text from the current cursor position to the end of the line.@item M-dKill from the cursor to the end of the current word, or if betweenwords, to the end of the next word.@item M-DELKill from the cursor to the start of the previous word, or if betweenwords, to the start of the previous word. @item C-wKill from the cursor to the previous whitespace. This is different than@key{M-DEL} because the word boundaries differ.@end tableAnd, here is how to @dfn{yank} the text back into the line. Yankingis@table @key@item C-yYank the most recently killed text back into the buffer at the cursor.@item M-yRotate the kill-ring, and yank the new top. You can only do this ifthe prior command is @key{C-y} or @key{M-y}.@end tableWhen you use a kill command, the text is saved in a @dfn{kill-ring}.Any number of consecutive kills save all of the killed text together, sothat when you yank it back, you get it in one clean sweep. The killring is not line specific; the text that you killed on a previouslytyped line is available to be yanked back later, when you are typinganother line.@node Readline Arguments@subsection Readline ArgumentsYou can pass numeric arguments to Readline commands. Sometimes theargument acts as a repeat count, other times it is the @i{sign} of theargument that is significant. If you pass a negative argument to acommand which normally acts in a forward direction, that command willact in a backward direction. For example, to kill text back to thestart of the line, you might type @key{M--} @key{C-k}.The general way to pass numeric arguments to a command is to type metadigits before the command. If the first `digit' you type is a minussign (@key{-}), then the sign of the argument will be negative. Onceyou have typed one meta digit to get the argument started, you can typethe remainder of the digits, and then the command. For example, to givethe @key{C-d} command an argument of 10, you could type @key{M-1 0 C-d}.@node Readline Init File@section Readline Init FileAlthough the Readline library comes with a set of Emacs-likekeybindings, it is possible that you would like to use a different setof keybindings. You can customize programs that use Readline by puttingcommands in an @dfn{init} file in your home directory. The name of thisfile is @file{~/.inputrc}.When a program which uses the Readline library starts up, the@file{~/.inputrc} file is read, and the keybindings are set.In addition, the @key{C-x C-r} command re-reads this init file, thusincorporating any changes that you might have made to it.@menu* Readline Init Syntax:: Syntax for the commands in @file{~/.inputrc}.* Readline Vi Mode:: Switching to @code{vi} mode in Readline.@end menu@node Readline Init Syntax@subsection Readline Init SyntaxThere are only four constructs allowed in the @file{~/.inputrc}file:@table @asis@item Variable SettingsYou can change the state of a few variables in Readline. You do this byusing the @code{set} command within the init file. Here is how youwould specify that you wish to use Vi line editing commands:@exampleset editing-mode vi@end exampleRight now, there are only a few variables which can be set; so few infact, that we just iterate them here:@table @code@item editing-mode@vindex editing-modeThe @code{editing-mode} variable controls which editing mode you areusing. By default, GNU Readline starts up in Emacs editing mode, wherethe keystrokes are most similar to Emacs. This variable can either beset to @code{emacs} or @code{vi}.@item horizontal-scroll-mode@vindex horizontal-scroll-modeThis variable can either be set to @code{On} or @code{Off}. Setting itto @code{On} means that the text of the lines that you edit will scrollhorizontally on a single screen line when they are larger than the widthof the screen, instead of wrapping onto a new screen line. By default,this variable is set to @code{Off}.@item mark-modified-lines@vindex mark-modified-lines
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -