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

📄 vi.in

📁 早期freebsd实现
💻 IN
📖 第 1 页 / 共 5 页
字号:
.\" 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.in	8.2 (Berkeley) 4/20/94.\".EH 'USD:11-%''An Introduction to Display Editing with Vi'.OH 'An Introduction to Display Editing with Vi''USD:11-%'.bd S 3.if t .ds dg \(dg.if n .ds dg +.if t .ds dd \(dd.if n .ds dd ++.\".RP.TLAn Introduction to Display Editing with Vi.AUWilliam Joy.AUMark Horton.AIComputer Science DivisionDepartment of Electrical Engineering and Computer ScienceUniversity of California, BerkeleyBerkeley, Ca.  94720.AB.PP.I Vi(visual) is a display oriented interactive text editor.When using.I vithe screen of your terminal acts as a window into the file which youare editing.  Changes which you make to the file are reflectedin what you see..PPUsing.I viyou can insert new text any place in the file quite easily.Most of the commands to.I vimove the cursor around in the file.There are commands to move the cursorforward and backward in units of characters, words,sentences and paragraphs.A small set of operators, like.B dfor delete and.B cfor change, are combined with the motion commands to form operationssuch as delete word or change paragraph, in a simple and natural way.This regularity and the mnemonic assignment of commands to keys makes theeditor command set easy to remember and to use..PP.I Viwill work on a large number of display terminals,and new terminals are easily driven after editing a terminal description file.While it is advantageous to have an intelligent terminal which can locallyinsert and delete lines and characters from the display, the editor willfunction quite well on dumb terminals over slow phone lines.The editor makes allowance for the low bandwidth in these situationsand uses smaller window sizes anddifferent display updating algorithms to make best use of thelimited speed available..PPIt is also possible to use the command set of.I vion hardcopy terminals, storage tubes and ``glass tty's'' using a one lineediting window; thus.I vi'scommand set is available on all terminals.The full command set of the more traditional, lineoriented editor.I exis available within.I vi;it is quite simple to switch between the two modes of editing..AE.NH 1Getting started.PP.FSThe financial support of an \s-2IBM\s0 Graduate Fellowship and theNational Science Foundation under grants MCS74-07644-A03 and MCS78-07291is gratefully acknowledged..FEThis document provides a quick introduction to.I vi.(Pronounced \fIvee-eye\fP.)You should be running.I vion a file you are familiar with while you are reading this.The first part of this document (sections 1 through 5)describes the basics of using.I vi.Some topics of special interest are presented in section 6, and some nitty-gritty details of how the editor functions are saved for section7 to avoid cluttering the presentation here..PPThere is also a short appendix here, which gives for each character thespecial meanings which this character has in \fIvi\fR.  Attached tothis document should be a quick reference card.This card summarizes the commands of.I viin a very compact format.  You should have the card handy while you arelearning.I vi..NH 2Specifying terminal type.PPBefore you can start.I viyou must tell the system what kind of terminal you are using.Here is a (necessarily incomplete) list of terminal type codes.If your terminal does not appear here, you should consult with one ofthe staff members on your system to find out the code for your terminal.If your terminal does not have a code, one can be assigned and a descriptionfor the terminal can be created..LP.TScenter;ab ab aba a a.Code	Full name	Type_2621	Hewlett-Packard 2621A/P	Intelligent2645	Hewlett-Packard 264x	Intelligentact4	Microterm ACT-IV	Dumbact5	Microterm ACT-V	Dumbadm3a	Lear Siegler ADM-3a	Dumbadm31	Lear Siegler ADM-31	Intelligentc100	Human Design Concept 100	Intelligentdm1520	Datamedia 1520	Dumbdm2500	Datamedia 2500	Intelligentdm3025	Datamedia 3025	Intelligentfox	Perkin-Elmer Fox	Dumbh1500	Hazeltine 1500	Intelligenth19	Heathkit h19	Intelligenti100	Infoton 100	Intelligentmime	Imitating a smart act4	Intelligentt1061	Teleray 1061	Intelligentvt52	Dec VT-52	Dumb.TE.PPSuppose for example that you have a Hewlett-Packard HP2621Aterminal.  The code used by the system for this terminal is `2621'.In this case you can use one of the following commands to tell the systemthe type of your terminal:.DS% \fBsetenv TERM\fP 2621.DEThis command works with the.I cshshell.If you are using the standard Bourne shell.I shthen you should give the commands.DS$ \fBTERM=\fP2621$ \fBexport TERM\fP.DE.PPIf you want to arrange to have your terminal type set up automaticallywhen you log in, you can use the.I tsetprogram.If you dial in on a.I mime ,but often use hardwired ports, a typical line for your.I .loginfile (if you use csh) would be.DS\fBsetenv TERM \(gatset\fP \- \-d mime\(ga.DEor for your.I .profilefile (if you use sh).DS\fBTERM=\(gatse\fPt \- \-d mime\(ga.DE.I Tsetknows which terminals are hardwired to each portand needs only to be told that when you dial in youare probably on a.I mime ..I Tsetis usually used to change the erase and kill characters, too..NH 2Editing a file.PPAfter telling the system which kind of terminal you have, you shouldmake a copy of a file you are familiar with, and run.I vion this file, giving the command.DS% \fBvi\fR \fIname\fR.DEreplacing \fIname\fR with the name of the copy file you just created.The screen should clear and the text of your file should appear on thescreen.  If something else happens refer to the footnote.\*(dd.FS\*(dd If you gave the system an incorrect terminal type code then theeditor may have just made a mess out of your screen.  This happens whenit sends control codes for one kind of terminal to some otherkind of terminal.  In this case hitthe keys \fB:q\fR (colon and the q key) and then hit the \s-2RETURN\s0 key.This should get you back to the command level interpreter.Figure out what you did wrong (ask someone else if necessary) and try again.     Another thing which can go wrong is that you typed the wrong file name andthe editor just printed an error diagnostic.  In this case you shouldfollow the above procedure for getting out of the editor, and try againthis time spelling the file name correctly.     If the editor doesn't seem to respond to the commands which you typehere, try sending an interrupt to it by hitting the \s-2DEL\s0 or \s-2RUB\s0key on your terminal, and then hitting the \fB:q\fR command again followedby a carriage return..sp.FE.NH 2The editor's copy: the buffer.PPThe editor does not directly modify the file which you are editing. Rather, the editor makes a copy of this file, in a place called the.I buffer,and remembers the file'sname.  You do not affect the contents of the file unless and until youwrite the changes you make back into the original file..NH 2Notational conventions.PPIn our examples, input which must be typed as is will be presented in\fBbold face\fR. Text which should be replaced with appropriate inputwill be given in \fIitalics\fR.  We will represent special charactersin \s-2SMALL CAPITALS\s0..NH 2Arrow keys.PPThe editor command set is independent of the terminalyou are using.  On most terminals with cursor positioning keys, these keyswill also work within the editor.If you don't have cursor positioning keys, or even if you do, you can usethe \fBh j k\fR and \fBl\fR keys as cursor positioningkeys (these are labelled with arrows on an.I adm3a).*.PP(Particular note for the HP2621: on this terminal the function keysmust be \fIshifted\fR (ick) to send to the machine, otherwise theyonly act locally.  Unshifted use will leave the cursor positionedincorrectly.).FS* As we will see later,.I hmoves back to the left (like control-h which is a backspace),.I jmoves down (in the same column),.I kmoves up (in the same column),and.I lmoves to the right..FE.NH 2Special characters: \s-2ESC\s0, \s-2CR\s0 and \s-2DEL\s0.PPSeveral of these special characters are very important, so be sure tofind them right now.  Look on your keyboard for a key labelled \s-2ESC\s0or \s-2ALT\s0.  It should be near the upper left corner of your terminal.Try hitting this key a few times.  The editor will ring the bellto indicate that it is in a quiescent state.\*(dd.FS\*(dd On smart terminals where it is possible, the editor will quietlyflash the screen rather than ringing the bell..FEPartially formed commands are cancelled by \s-2ESC\s0, and when you inserttext in the file you end the text insertionwith \s-2ESC\s0.  This key is a fairlyharmless one to hit, so you can just hit it if you don't knowwhat is going on until the editor rings the bell..PPThe \s-2CR\s0 or \s-2RETURN\s0 key is important because it is usedto terminate certain commands.It is usually at the right side of the keyboard,and is the same command used at the end of each shell command..PPAnother very useful key is the \s-2DEL\s0 or \s-2RUB\s0 key, which generatesan interrupt, telling the editor to stop what it is doing.It is a forceful way of making the editor listento you, or to return it to the quiescent state if you don't know or don'tlike what is going on.  Try hitting the `/' key on your terminal.  Thiskey is used when you want to specify a string to be searched for.  Thecursor should now be positioned at the bottom line of the terminal aftera `/' printed as a prompt.  You can get the cursor back to the currentposition by hitting the \s-2DEL\s0 or \s-2RUB\s0 key; try this now.*.FS* Backspacing over the `/' will also cancel the search..FEFrom now on we will simply refer to hitting the \s-2DEL\s0 or \s-2RUB\s0key as ``sending an interrupt.''**.FS** On some systems, this interruptibility comes at a price: you cannot typeahead when the editor is computing with the cursor on the bottom line..FE.PPThe editor often echoes your commands on the last line of the terminal.If the cursor is on the first position of this last line, then the editoris performing a computation, such as computing a new position in thefile after a search or running a command to reformat part of the buffer.When this is happening you can stop the editor bysending an interrupt..NH 2Getting out of the editor.PPAfter you have worked with this introduction for a while, and you wishto do something else, you can give the command \fBZZ\fPto the editor.

⌨️ 快捷键说明

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