📄 vip.texinfo
字号:
@node Mark Commands, Motion Commands, Viewing the Buffer, Vi Commands@section Mark CommandsThe following commands are used to mark positions in the buffer.@table @kbd@item m @var{ch}@kindex 155 @kbd{m} (@code{vip-mark-point})Store current point in the register @var{ch}. @var{ch} must be a lowercase character between @kbd{a} and @kbd{z}.@item m <Set mark at the beginning of current buffer.@item m >Set mark at the end of current buffer.@item m .Set mark at point.@item m ,Jump to mark (and pop mark off the mark ring).@end table@cindex mark ringEmacs uses the @dfn{mark ring} to store marked positions. The commands@kbd{m <}, @kbd{m >} and @kbd{m .}@: not only set mark but also add it as thelatest element of the mark ring (replacing the oldest one). By repeatingthe command `@kbd{m ,}' you can visit older and older marked positions. Youwill eventually be in a loop as the mark ring is a ring.@node Motion Commands, Searching and Replacing, Mark Commands, Vi Commands@section Motion CommandsCommands for moving around in the current buffer are collected here. Thesecommands are used as an `argument' for the delete, change and yank commandsto be described in the next section.@table @kbd@item h@kindex 150 @kbd{h} (@code{vip-backward-char})Move point backward by one character. Signal error if point is at thebeginning of buffer, but (unlike Vi) do not complain otherwise(@code{vip-backward-char}).@item l@kindex 154 @kbd{l} (@code{vip-forward-char})Move point backward by one character. Signal error if point is at theend of buffer, but (unlike Vi) do not complain otherwise(@code{vip-forward-char}).@item j@kindex 152 @kbd{j} (@code{vip-next-line})Move point to the next line keeping the current column. If point is on thelast line of the buffer, a new line will be created and point will move tothat line (@code{vip-next-line}).@item k@kindex 153 @kbd{k} (@code{vip-previous-line})Move point to the previous line keeping the current column(@code{vip-next-line}).@item +@kindex 053 @kbd{+} (@code{vip-next-line-at-bol})Move point to the next line at the first non-white character. If point ison the last line of the buffer, a new line will be created and point willmove to the beginning of that line (@code{vip-next-line-at-bol}).@item -@kindex 055 @kbd{-} (@code{vip-previous-line-at-bol})Move point to the previous line at the first non-white character(@code{vip-previous-line-at-bol}).@end table@noindentIf a count is given to these commands, the commands will be repeated thatmany times.@table @kbd@item 0@kindex 060 @kbd{0} (@code{vip-beginning-of-line})Move point to the beginning of line (@code{vip-beginning-of-line}).@item ^@kindex 136 @kbd{^} (@code{vip-bol-and-skip-white})Move point to the first non-white character on the line(@code{vip-bol-and-skip-white}).@item $@kindex 044 @kbd{$} (@code{vip-goto-eol})Move point to the end of line (@code{vip-goto-eol}).@item @var{n} |@kindex 174 @kbd{|} (@code{vip-goto-col})Move point to the @var{n}-th column on the line (@code{vip-goto-col}).@end table@noindentExcept for the @kbd{|} command, these commands neglect a count.@cindex word@table @kbd@item w@kindex 167 @kbd{w} (@code{vip-forward-word})Move point forward to the beginning of the next word(@code{vip-forward-word}).@item W@kindex 127 @kbd{W} (@code{vip-forward-Word})Move point forward to the beginning of the next word, where a @dfn{word} isconsidered as a sequence of non-white characters (@code{vip-forward-Word}).@item b@kindex 142 @kbd{b} (@code{vip-backward-word})Move point backward to the beginning of a word (@code{vip-backward-word}).@item B@kindex 102 @kbd{B} (@code{vip-backward-Word})Move point backward to the beginning of a word, where a @i{word} isconsidered as a sequence of non-white characters (@code{vip-forward-Word}).@item e@kindex 145 @kbd{e} (@code{vip-end-of-word})Move point forward to the end of a word (@code{vip-end-of-word}).@item E@kindex 105 @kbd{E} (@code{vip-end-of-Word})Move point forward to the end of a word, where a @i{word} isconsidered as a sequence of non-white characters (@code{vip-end-of-Word}).@end table@noindent@cindex syntax tableHere the meaning of the word `word' for the @kbd{w}, @kbd{b} and @kbd{e}commands is determined by the @dfn{syntax table} effective in the currentbuffer. Each major mode has its syntax mode, and therefore the meaning ofa word also changes as the major mode changes. See GNU Emacs Manual fordetails of syntax table.@table @kbd@item H@kindex 110 @kbd{H} (@code{vip-window-top})Move point to the beginning of the @i{home} (top) line of the window.Given a count @var{n}, go to the @var{n}-th line from top(@code{vip-window-top}).@item M@kindex 115 @kbd{M} (@code{vip-window-middle})Move point to the beginning of the @i{middle} line of the window. Givena count @var{n}, go to the @var{n}-th line from the middle line(@code{vip-window-middle}).@item L@kindex 114 @kbd{L} (@code{vip-window-bottom})Move point to the beginning of the @i{lowest} (bottom) line of thewindow. Given count, go to the @var{n}-th line from bottom(@code{vip-window-bottom}).@end table@noindentThese commands can be used to go to the desired line visible on the screen.@table @kbd@item (@kindex 050 @kbd{(} (@code{vip-backward-sentence})Move point backward to the beginning of the sentence(@code{vip-backward-sentence}).@item )@kindex 051 @kbd{)} (@code{vip-forward-sentence})Move point forward to the end of the sentence(@code{vip-forward-sentence}).@item @{@kindex 173 @kbd{@{} (@code{vip-backward-paragraph})Move point backward to the beginning of the paragraph(@code{vip-backward-paragraph}).@item @}@kindex 175 @kbd{@}} (@code{vip-forward-paragraph})Move point forward to the end of the paragraph(@code{vip-forward-paragraph}).@end table@noindentA count repeats the effect for these commands.@table @kbd@item G@kindex 107 @kbd{G} (@code{vip-goto-line})Given a count @var{n}, move point to the @var{n}-th line in the buffer onthe first non-white character. Without a count, go to the end of the buffer(@code{vip-goto-line}).@item ` `@kindex 140 @kbd{`} (@code{vip-goto-mark})Exchange point and mark (@code{vip-goto-mark}).@item ` @var{ch}Move point to the position stored in the register @var{ch}. @var{ch} mustbe a lower case letter.@item ' '@kindex 047 @kbd{'} (@code{vip-goto-mark-and-skip-white})Exchange point and mark, and then move point to the first non-whitecharacter on the line (@code{vip-goto-mark-and-skip-white}).@item ' @var{ch}Move point to the position stored in the register @var{ch} and skip to thefirst non-white character on the line. @var{ch} must be a lower case letter.@item %@kindex 045 @kbd{%} (@code{vip-paren-match})Move point to the matching parenthesis if point is looking at @kbd{(},@kbd{)}, @kbd{@{}, @kbd{@}}, @kbd{[} or @kbd{]}@*(@code{vip-paren-match}).@end table@noindentThe command @kbd{G} mark point before move, so that you can return to theoriginal point by @kbd{` `}. The original point will also be stored inthe mark ring.The following commands are useful for moving points on the line. A countwill repeat the effect.@table @kbd@item f @var{ch}@kindex 146 @kbd{f} (@code{vip-find-char-forward})Move point forward to the character @var{ch} on the line. Signal error if@var{ch} could not be found (@code{vip-find-char-forward}).@item F @var{ch}@kindex 106 @kbd{F} (@code{vip-find-char-backward})Move point backward to the character @var{ch} on the line. Signal error if@var{ch} could not be found (@code{vip-find-char-backward}).@item t @var{ch}@kindex 164 @kbd{t} (@code{vip-goto-char-forward})Move point forward upto the character @var{ch} on the line. Signal error if@var{ch} could not be found (@code{vip-goto-char-forward}).@item T @var{ch}@kindex 124 @kbd{T} (@code{vip-goto-char-backward})Move point backward upto the character @var{ch} on the line. Signal error if@var{ch} could not be found (@code{vip-goto-char-backward}).@item ;@kindex 073 @kbd{;} (@code{vip-repeat-find})Repeat previous @kbd{f}, @kbd{t}, @kbd{F} or @kbd{T} command(@code{vip-repeat-find}).@item ,@kindex 054 @kbd{,} (@code{vip-repeat-find-opposite})Repeat previous @kbd{f}, @kbd{t}, @kbd{F} or @kbd{T} command, in theopposite direction (@code{vip-repeat-find-opposite}).@end table@node Searching and Replacing, Modifying Commands, Motion Commands, Vi Commands@section Searching and ReplacingFollowing commands are available for searching and replacing.@cindex regular expression (search)@table @kbd@item / @var{string} @key{RET}@kindex 057 @kbd{/} (@code{vip-search-forward})Search the first occurrence of the string @var{string} forward startingfrom point. Given a count @var{n}, the @var{n}-th occurrence of@var{string} will be searched. If the variable @code{vip-re-search} has value@code{t} then @dfn{regular expression} search is done and the stringmatching the regular expression @var{string} is found. If you give anempty string as @var{string} then the search mode will change from vanillasearch to regular expression search and vice versa(@code{vip-search-forward}).@item ? @var{string} @key{RET}@kindex 077 @kbd{?} (@code{vip-search-backward})Same as @kbd{/}, except that search is done backward(@code{vip-search-backward}).@item n@kindex 156 @kbd{n} (@code{vip-search-next})Search the previous search pattern in the same direction as before(@code{vip-search-next}).@item N@kindex 116 @kbd{N} (@code{vip-search-Next})Search the previous search pattern in the opposite direction(@code{vip-search-Next}).@item C-s@kindex 023 @kbd{C-s} (@code{isearch-forward})Search forward incrementally. See GNU Emacs Manual for details(@code{isearch-forward}).@item C-r@kindex 022 @kbd{C-r} (@code{isearch-backward})Search backward incrementally (@code{isearch-backward}).@cindex vanilla (replacement)@cindex regular expression (replacement)@item R @var{string} RET @var{newstring}@kindex 122 @kbd{R} (@code{vip-replace-string})There are two modes of replacement, @dfn{vanilla} and @dfn{regular expression}.If the mode is @i{vanilla} you will get a prompt @samp{Replace string:},and if the mode is @i{regular expression} you will ge a prompt@samp{Replace regexp:}. The mode is initially @i{vanilla}, but you cantoggle these modes by giving a null string as @var{string}. If the mode isvanilla, this command replaces every occurrence of @var{string} with@var{newstring}. If the mode is regular expression, @var{string} istreated as a regular expression and every string matching the regularexpression is replaced with @var{newstring} (@code{vip-replace-string}).@item Q @var{string} RET @var{newstring}@kindex 121 @kbd{Q} (@code{vip-query-replace})Same as @kbd{R} except that you will be asked form confirmation before eachreplacement@*(@code{vip-query-replace}).@item r @var{ch}@kindex 162 @kbd{r} (@code{vip-replace-char})Replace the character point is looking at by the character @var{ch}. Givecount, replace that many characters by @var{ch} (@code{vip-replace-char}).@end table@noindentThe commands @kbd{/} and @kbd{?} mark point before move, so that you canreturn to the original point by @w{@kbd{` `}}.@node Modifying Commands, Delete Commands, Searching and Replacing, Vi Commands@section Modifying CommandsIn this section, commands for modifying the content of a buffer aredescribed. These commands affect the region determined by a motion commandwhich is given to the commands as their argument.@cindex point commands@cindex line commandsWe classify motion commands into @dfn{point commands} and@dfn{line commands}. The point commands are as follows:@example@kbd{h}, @kbd{l}, @kbd{0}, @kbd{^}, @kbd{$}, @kbd{w}, @kbd{W}, @kbd{b}, @kbd{B}, @kbd{e}, @kbd{E}, @kbd{(}, @kbd{)}, @kbd{/}, @kbd{?}, @kbd{`}, @kbd{f}, @kbd{F}, @kbd{t}, @kbd{T}, @kbd{%}, @kbd{;}, @kbd{,}@end example@noindentThe line commands are as follows:@example@kbd{j}, @kbd{k}, @kbd{+}, @kbd{-}, @kbd{H}, @kbd{M}, @kbd{L}, @kbd{@{}, @kbd{@}}, @kbd{G}, @kbd{'}@end example@noindent@cindex expanding (region)If a point command is given as an argument to a modifying command, theregion determined by the point command will be affected by the modifyingcommand. On the other hand, if a line command is given as an argument to amodifying command, the region determined by the line command will beenlarged so that it will become the smallest region properly containing theregion and consisting of whole lines (we call this process @dfn{expandingthe region}), and then the enlarged region will be affected by the modifyingcommand.@menu* Delete Commands:: Commands for deleting text.* Yank Commands:: Commands for yanking text in Vi's sense.* Put Back Commands:: Commands for putting bake deleted/yanked text.* Change Commands:: Commands for changing text.@end menu@node Delete Commands, Yank Commands, Modifying Commands, Modifying Commands@subsection Delete Commands@table @kbd@item d @var{motion-command}@kindex 1440 @kbd{d} (@code{vip-command-argument})Delete the region determined by the motion command @var{motion-command}.@end table@noindentFor example, @kbd{d $} will delete the region between point and end ofcurrent line since @kbd{$} is a point command that moves point to end of line.@kbd{d G} will delete the region between the beginning of current line andend of the buffer, since @kbd{G} is a line command. A count given to the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -