⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vi.apwh.ms

📁 早期freebsd实现
💻 MS
📖 第 1 页 / 共 3 页
字号:
.\" Copyright (c) 1980, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)vi.apwh.ms	8.1 (Berkeley) 6/8/93.\".TLVi Command & Function Reference.AU CB 2675Alan P.W. Hewett.spRevised for version 2.12 by Mark Horton.CB.NH 1Author's Disclaimer.LPThis document does not claim to be 100% complete.  There are afew commands listed in the original document that I was unableto test either because I do not speak \fBlisp\fR, because theyrequired programs we don't have, or because I wasn't able to makethem work.  In these cases I left the command out.  The commandslisted in this document have been tried and are known to work.It is expected that prospective users of this document will readit once to get the flavor of everything that \fBvi\fR can doand then use it as a reference document.  Experimentation isrecommended.  If you don't understand a command, try it andsee what happens..LP[Note: In revising this document, I have attempted to make itcompletely reflect version 2.12 of.B vi .It does not attempt to document the VAX version (version 3),but with one or two exceptions (wrapmargin, arrow keys)everything said about 2.12 should apply to 3.1..I "Mark Horton" ].NH 1Notation.LP\fB[option]\fR is used to denote optional parts of a command.Many \fBvi\fR commands have an optional count.  \fB[cnt]\fRmeans that an optional number may precede the command tomultiply or iterate the command.\fB{variable item}\fR is used to denote parts of the commandwhich must appear, but can take a number of different values.\fB<character [-character]>\fR means that the character orone of the characters in the range described between thetwo angle brackets is to be typed.For example \fB<esc>\fR meansthe \fBescape\fR key is to be typed.  \fB<a-z>\fR means that alower case letter is to be typed.  \fB^<character>\fR means thatthe character is to be typed as a \fBcontrol\fR character, that is,with the \fB<cntl>\fR key held down while simultaneously typingthe specified character.  In this document control characters willbe denoted using the \fIupper case\fR character, but^<uppercase chr> and ^<lowercase chr> are equivalent.  That is, forexample, \fB<^D>\fR is equal to \fB<^d>\fR.The most common character abbreviationsused in this list are as follows:.VL 8.IP <esc> 8escape, octal 033.IP <cr> 8carriage return, ^M, octal 015.IP <lf> 8linefeed ^J, octal 012.IP <nl> 8newline, ^J, octal 012 (same as linefeed).IP <bs> 8backspace, ^H, octal 010.IP <tab> 8tab, ^I, octal 011.IP <bell> 8bell, ^G, octal 07.IP <ff> 8formfeed, ^L, octal 014.IP <sp> 8space, octal 040.IP <del> 8delete, octal 0177.LE.sp 1.NH 1Basics.LPTo run \fBvi\fR the shell variable \fBTERM\fR must be defined andexported to your environment.How you do this depends on which shell you are using.You can tell which shell you have by the character itprompts you for commands with.The Bourne shell prompts with `$', and the C shell prompts with `%'.For these examples, we will supposethat you are using an HP 2621 terminal, whose termcap name is ``2621''..NH 2Bourne Shell.LPTo manually set your terminal type to 2621 you would type:.DSTERM=2621export TERM.DE.PPThere are various ways of having this automatically orsemi-automatically done when you log in.Suppose you usually dial in on a 2621.You want to tell this to the machine, but still have itwork when you use a hardwired terminal.The recommended way, if you have the.B tsetprogram, is to use the sequence.DStset \-s \-d 2621 > tset$$\&. tset$$rm tset$$.DEin your .login (for csh) or the same thing using `.' instead of `source'in your .profile (for sh).The above line says that if you are dialing in you are on a 2621,but if you are on a hardwired terminal it figures out your terminaltype from an on-line list..NH 2The C Shell.LPTo manually set your terminal type to 2621 you would type:.DSsetenv TERM 2621.DE.PPThere are various ways of having this automatically orsemi-automatically done when you log in.Suppose you usually dial in on a 2621.You want to tell this to the machine, but still have itwork when you use a hardwired terminal.The recommended way, if you have the.B tsetprogram, is to use the sequence.DStset \-s \-d 2621 > tset$$source tset$$rm tset$$.DEin your .login.*.FS* On a version 6 systemwithout environments, the invocation of tsetis simpler, just add the line ``tset \-d 2621''to your .login or .profile..FEThe above line says that if you are dialing in you are on a 2621,but if you are on a hardwired terminal it figures out your terminaltype from an on-line list..NH 1Normal Commands.LP\fBVi\fR is a visual editor with a window on the file.  Whatyou see on the screen is \fBvi\fR's current notion ofwhat your file will contain,(at this point in the file),when it is written out.Most commands do not cause any change in the screen until thecomplete command is typed.  Should you get confused whiletyping a command, you can abort the command by typing an<del> character.  You will know you are back to command levelwhen you hear a <bell>.  Usually typing an <esc> will produce thesame result.  When \fBvi\fR gets an improperly formatted commandit rings the <bell>.Following are the \fBvi\fR commands broken down by function..NH 2Entry and Exit.LPTo enter.B vion a particular.I file ,type.DS\fBvi\fP \fIfile\fP.DEThe file will be read in and the cursor will be placed at the beginningof the first line.The first screenfull of the file will be displayed on the terminal..PPTo get out of the editor, type.DSZZ.DEIf you are in some special mode, such as input modeor the middle of a multi-keystroke command, it maybe necessary to type <esc> first..NH 2Cursor and Page Motion.LP.VL 16.B NOTE:The arrow keys (see the next four commands)on certain kinds of terminals will not work with thePDP-11 version of vi.  The control versions or the hjkl versions willwork on any terminal.  Experienced users prefer the hjkl keys becausethey are always right under their fingers.  Beginners often preferthe arrow keys, since they do not require memorization of which hjklkey is which.The mnemonic value of hjkl is clear from looking at the keyboard of an adm3a..sp.IP "[cnt]<bs> or [cnt]h or [cnt]\(<-" 16.brMove the cursor to the left one character.  Cursor stops at the leftmargin of the page.If cnt is given, these commands move that many spaces..IP "[cnt]^N or [cnt]j or [cnt]\(da or [cnt]<lf>" 16.brMove down one line.Moving off the screen scrolls the window to force a new lineonto the screen.Mnemonic: \fBN\fRext.IP "[cnt]^P or [cnt]k or [cnt]\(ua" 16.brMove up one line.Moving off the top of the screen forces new text onto the screen.Mnemonic: \fBP\fRrevious.IP "[cnt]<sp> or [cnt]l or [cnt]\(->" 16.brMove to the right one character.Cursor will not go beyond the end of the line..IP [cnt]- 16Move the cursor up the screen to the beginning of the next line.Scroll if necessary..IP "[cnt]+ or [cnt]<cr>" 16.sp 1Move the cursor down the screen to the beginning of the next line.Scroll up if necessary..IP "[cnt]$" 16Move the cursor to the end of the line.If there is a count, move to the end of the line "cnt" linesforward in the file..IP "^" 16Move the cursor to the beginning of the first word on the line..IP "0" 16Move the cursor to the left margin of the current line..IP "[cnt]|" 16Move the cursor to the column specified by the count.  The default iscolumn zero..IP "[cnt]w" 16Move the cursor to the beginning of the next word. If thereis a count, then move forward that many words andposition the cursor at the beginning of the word.Mnemonic: next-\fBw\fRord.IP "[cnt]W" 16Move the cursor to the beginning of the next word which followsa "white space" (<sp>,<tab>, or <nl>).  Ignore other punctuation..IP "[cnt]b" 16Move the cursor to the preceding word.  Mnemonic: \fBb\fRackup-word.IP "[cnt]B" 16Move the cursor to the preceding word that is separated from thecurrent word by a "white space" (<sp>,<tab>, or <nl>)..IP "[cnt]e" 16Move the cursor to the end of the current word or the end of the"cnt"'th word hence.  Mnemonic: \fBe\fRnd-of-word.IP "[cnt]E" 16Move the cursor to the end of the current word which is delimited by"white space" (<sp>,<tab>, or <nl>)..IP "[line number]G" 16.brMove the cursor to the line specified.  Of particular use are thesequences "1G" and "G", which move the cursor to the beginning andthe end of the file respectively.  Mnemonic: \fBG\fRo-to.LP.B NOTE:The next four commands (^D, ^U, ^F, ^B)are not true motion commands, in that theycannot be used as the object of commands such as delete or change..IP "[cnt]^D" 16Move the cursor down in the file by "cnt" lines (or the last "cnt"if a new count isn't given.  The initial default is half a page.)  Thescreen is simultaneously scrolled up.  Mnemonic: \fBD\fRown.IP "[cnt]^U" 16Move the cursor up in the file by "cnt" lines.  The screen is simultaneouslyscrolled down.  Mnemonic: \fBU\fRp.IP "[cnt]^F" 16Move the cursor to the next page.  A count moves that many pages.Two lines of the previous page are kept on the screen for continuity ifpossible.  Mnemonic: \fBF\fRorward-a-page.IP "[cnt]^B" 16Move the cursor to the previous page.  Two lines of the current pageare kept if possible.  Mnemonic: \fBB\fRackup-a-page.IP "[cnt](" 16Move the cursor to the beginning of the next sentence.A sentence is defined as ending with a ".", "!", or "?"followed by two spaces or a <nl>..IP "[cnt])" 16Move the cursor backwards to the beginning of a sentence..IP "[cnt]}" 16Move the cursor to the beginning of the next paragraph.  This commandworks best inside \fBnroff\fR documents.  It understands two sets of\fBnroff\fR macros, \fB\-ms\fR and \fB\-mm\fR, for which thecommands ".IP", ".LP", ".PP", ".QP", "P", as well as the nroff command ".bp"are considered to be paragraph delimiters.A blank line also delimits a paragraph.The \fBnroff\fR macros that it accepts as paragraph delimiters isadjustable.  See \fBparagraphs\fR under the \fBSet Commands\fR section..IP "[cnt]{" 16Move the cursor backwards to the beginning of a paragraph..IP "]]" 16Move the cursor to the next "section", where a section is defined bytwo sets of \fBnroff\fR macros, \fB\-ms\fR and \fB\-mm\fR, in which".NH", ".SH", and ".H" delimit a section.  A line beginning with a <ff><nl>sequence, or a line beginning with a "{" are also considered tobe section delimiters.  The last option makes ituseful for finding the beginnings of C functions.The \fBnroff\fR macros that are used for section delimiters can be adjusted.See \fBsections\fR under the \fBSet Commands\fR section..IP "[[" 16Move the cursor backwards to the beginning of a section..IP "%" 16Move the cursor to the matching parenthesisor brace.  This is very useful in C or lisp code.  If thecursor is sitting on a \fB( ) {\fR or \fB}\fR the cursoris moved to the matching character at the other end of thesection.  If the cursor is not sitting on a brace or aparenthesis, \fBvi\fR searches forward until it finds oneand then jumps to the match mate..IP "[cnt]H" 16If there is no count move the cursor to the top left position on the screen.If there is a count, then move the cursor to the beginning of the line"cnt" lines from the top of the screen.  Mnemonic:  \fBH\fRome.IP "[cnt]L" 16If there is no count move the cursor to the beginningof the last line on the screen.If there is a count, then move the cursor to the beginning of the line"cnt" lines from the bottom of the screen.  Mnemonic: \fBL\fRast.IP "M" 16Move the cursor to the beginning of the middle line on the screen.Mnemonic: \fBM\fRiddle.IP "m<a-z>" 16This command does not move the cursor, but it \fBmarks\fR the place

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -