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

📄 ex.rm

📁 早期freebsd实现
💻 RM
📖 第 1 页 / 共 4 页
字号:
.\" 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..\".\"	@(#)ex.rm	8.2 (Berkeley) 4/20/94.\".EH 'USD:12-%''Ex Reference Manual'.OH 'Ex Reference Manual''USD:12-%'.de ZP.nr pd \\n()P.nr )P 0.if \\n(.$=0 .IP.if \\n(.$=1 .IP "\\$1".if \\n(.$>=2 .IP "\\$1" "\\$2".nr )P \\n(pd.rm pd...de LC.br.sp .1i.ne 4.LP.ta 4.0i...bd S B 3.\".RP.TLEx Reference Manual.brVersion 3.7.AUWilliam Joy.AUMark Horton.AIComputer Science DivisionDepartment of Electrical Engineering and Computer ScienceUniversity of California, BerkeleyBerkeley, Ca.  94720.AB.I Exa line oriented text editor, which supports both command and displayoriented editing.This reference manual describes the command oriented part of.I ex;the display editing features of.I exare described in.I "An Introduction to Display Editing with Vi."Other documents about the editor include the introduction.I "Edit: A tutorial",the.I "Ex/edit Command Summary",and a.I "Vi Quick Reference"card..AE.NH 1Starting ex.PP.FSThe financial support of an \s-2IBM\s0 Graduate Fellowship and the NationalScience Foundation under grants MCS74-07644-A03 and MCS78-07291 is gratefullyacknowledged..FEEach instance of the editor has a set of options,which can be set to tailor it to your liking.The command.I editinvokes a version of.I exdesigned for more casual or beginningusers by changing the default settings of some of these options.To simplify the description which follows weassume the default settings of the options..PPWhen invoked,.I exdetermines the terminal type from the \s-2TERM\s0 variable in the environment.It there is a \s-2TERMCAP\s0 variable in the environment, and the typeof the terminal described there matches the \s-2TERM\s0 variable,then that descriptionis used.  Also if the \s-2TERMCAP\s0 variable contains a pathname (beginningwith a \fB/\fR) then the editor will seek the description of the terminalin that file (rather than the default /etc/termcap).If there is a variable \s-2EXINIT\s0 in the environment, then the editorwill execute the commands in that variable,otherwise if there is a file.I \&.exrcin your \s-2HOME\s0 directory.I exreads commands from that file, simulating a.I sourcecommand.Option setting commands placed in\s-2EXINIT\s0 or.I \&.exrcwill be executed before each editor session..PPA command to enter.I exhas the following prototype:\(dg.FS\(dg Brackets `[' `]' surround optional parameters here..FE.DS\fBex\fP [ \fB\-\fP ] [ \fB\-v\fP ] [ \fB\-t\fP \fItag\fP ] [ \fB\-r\fP ] [ \fB\-l\fP ] [ \fB\-w\fP\fIn\fP ] [ \fB\-x\fP ] [ \fB\-R\fP ] [ \fB+\fP\fIcommand\fP ] name ....DEThe most common case edits a single file with no options, i.e.:.DS\fBex\fR name.DEThe.B \-command line optionoption suppresses all interactive-user feedbackand is useful in processing editor scripts in command files.The.B \-voption is equivalent to using.I virather than.I ex.The.B \-toption is equivalent to an initial.I tagcommand, editing the file containing the.I tagand positioning the editor at its definition.The.B \-roption is used in recovering after an editor or system crash,retrieving the last saved version of the named file or,if no file is specified,typing a list of saved files.The.B \-loption sets up for editing \s-2LISP\s0, setting the.I showmatchand.I lispoptions.The.B \-woption sets the default window size to.I n,and is useful on dialups to start in small windows.The.B \-xoption causes.I exto prompt for a.I key ,which is used to encrypt and decrypt the contents of the file,which should already be encrypted using the same key,see.I crypt (1).The.B \-Roption sets the.I readonlyoption at the start..I Namearguments indicate files to be edited.An argument of the form\fB+\fIcommand\fRindicates that the editor should begin by executing the specified command.If.I commandis omitted, then it defaults to ``$'', positioning the editor at the lastline of the first file initially.  Other useful commands here are scanningpatterns of the form ``/pat'' or line numbers, e.g. ``+100'' startingat line 100..NH 1File manipulation.NH 2Current file.PP.I Exis normally editing the contents of a single file,whose name is recorded in the.I currentfile name..I Experforms all editing actions in a buffer(actually a temporary file)into which the text of the file is initially read.Changes made to the buffer have no effect on the file beingedited unless and until the buffer contents are written out to thefile with a.I writecommand.After the buffer contents are written,the previous contents of the written file are no longer accessible.When a file is edited,its name becomes the current file name,and its contents are read into the buffer..PPThe current file is almost always considered to be.I edited.This means that the contents of the buffer are logicallyconnected with the current file name,so that writing the current buffer contents onto that file,even if it exists,is a reasonable action.If the current file is not .I editedthen.I exwill not normally write on it if it already exists.*.FS* The.I filecommand will say ``[Not edited]'' if the current file is not considerededited..FE.NH 2Alternate file.PPEach time a new value is given to the current file name,the previous current file name is saved as the.I alternatefile name.Similarly if a file is mentioned but does not become the current file,it is saved as the alternate file name..NH 2Filename expansion.PPFilenames within the editor may be specified using the normalshell expansion conventions.In addition,the character `%' in filenames is replaced by the.I currentfile name and the character`#' by the.I alternatefile name.\(dg.FS\(dg This makes it easy to deal alternately withtwo files and eliminates the need for retyping thename supplied on an.I editcommand after a .I "No write since last change"diagnostic is received..FE.NH 2Multiple files and named buffers.PPIf more than one file is given on the command line,then the first file is edited as described above.The remaining arguments are placed with the first file in the.I "argument list."The current argument list may be displayed with the.I argscommand.The next file in the argument list may be edited with the.I nextcommand.The argument list may also be respecified by specifyinga list of names to the.I nextcommand.These names are expanded,the resulting list of names becomes the new argument list,and.I exedits the first file on the list..PPFor saving blocks of text while editing, and especially when editingmore than one file,.I exhas a group of named buffers.These are similar to the normal buffer, except that only a limited numberof operations are available on them.The buffers have names.I athrough.I z.\(dd.FS\(dd It is also possible to refer to.I Athrough.I Z;the upper case buffers are the same as the lower but commandsappend to named buffers rather than replacingif upper case names are used..FE.NH 2Read only.PPIt is possible to use.I exin.I "read only"mode to look at files that you have no intention of modifying.This mode protects you from accidently overwriting the file.Read only mode is on when the.I readonlyoption is set.It can be turned on with the.B \-Rcommand line option,by the.I viewcommand line invocation,or by setting the.I readonlyoption.It can be cleared by setting.I noreadonly .It is possible to write, even while in read only mode, by indicatingthat you really know what you are doing.You can write to a different file, or can use the ! form of write,even while in read only mode..NH 1Exceptional Conditions.NH 2Errors and interrupts.PPWhen errors occur.I ex(optionally) rings the terminal bell and, in any case, prints an errordiagnostic.  If the primary input is from a file, editor processingwill terminate.  If an interrupt signal is received,.I exprints ``Interrupt'' and returns to its command level.  If the primaryinput is a file, then.I exwill exit when this occurs..NH 2Recovering from hangups and crashes.PPIf a hangup signal is received and the buffer has been modified sinceit was last written out, or if the system crashes, either the editor(in the first case) or the system (after it reboots in the second) willattempt to preserve the buffer.  The next time you log in you should beable to recover the work you were doing, losing at most a few lines ofchanges from the last point before the hangup or editor crash.  Torecover a file you can use the.B \-roption.  If you were editing the file.I resume,then you should changeto the directory where you were when the crash occurred, giving the command.DS\fBex \-r\fP\fI resume\fP.DEAfter checking that the retrieved file is indeed ok, you can.I writeit over the previous contents of that file..PPYou will normally get mail from the system telling you when a file hasbeen saved after a crash.  The command.DS\fBex\fP \-\fBr\fP.DEwill print a list of the files which have been saved for you.(In the case of a hangup,the file will not appear in the list,although it can be recovered.).NH 1Editing modes.PP.I Exhas five distinct modes.  The primary mode is.I commandmode.  Commands are entered in command mode when a `:' prompt ispresent, and are executed each time a complete line is sent.  In.I "text input"mode.I exgathers input lines and places them in the file.  The.I append,.I insert,and.I changecommands use text input mode.No prompt is printed when you are in text input mode.This mode is left by typing a `.' alone at the beginning of a line, and.I commandmode resumes..PPThe last three modes are.I openand.I visualmodes, entered by the commands of the same name, and, within open andvisual modes.I "text insertion"mode..I Openand.I visualmodes allow local editing operations to be performed on the text in thefile.  The.I opencommand displays one line at a time on any terminal while.I visualworks on \s-2CRT\s0 terminals with random positioning cursors, using thescreen as a (single) window for file editing changes.These modes are described (only) in.I "An Introduction to Display Editing with Vi.".NH Command structure.PPMost command names are English words,and initial prefixes of the words are acceptable abbreviations.The ambiguity of abbreviations is resolved in favor of the more commonlyused commands.*.FS* As an example, the command .I substitutecan be abbreviated `s'while the shortest available abbreviation for the .I setcommand is `se'..FE.NH 2Command parameters.PPMost commands accept prefix addresses specifying the lines in the fileupon which they are to have effect.The forms of these addresses will be discussed below.A number of commands also may take a trailing.I countspecifying the number of lines to be involved in the command.\(dg.FS\(dg Counts are rounded down if necessary..FEThus the command ``10p'' will print the tenth line in the buffer while``delete 5'' will delete five lines from the buffer,starting with the current line..PPSome commands take other information or parameters,this information always being given after the command name.\(dd.FS\(dd Examples would be option names in a.I setcommand i.e. ``set number'',a file name in an.I editcommand,a regular expression in a.I substitutecommand,or a target address for a.I copycommand, i.e. ``1,5 copy 25''..FE.NH 2Command variants.PPA number of commands have two distinct variants.The variant form of the command is invoked by placing an`!' immediately after the command name.Some of the default variants may be controlled by options;in this case, the `!' serves to toggle the default..NH 2Flags after commands.PPThe characters `#', `p' and `l' may be placed after many commands.**.FS**A `p' or `l' must be preceded by a blank or tabexcept in the single special case `dp'..FEIn this case, the command abbreviated by these charactersis executed after the command completes.Since.I exnormally prints the new current line after each change, `p' is rarely necessary.Any number of `+' or `\-' characters may also be given with these flags.If they appear, the specified offset is applied to the current linevalue before the printing command is executed..NH 2Comments.PPIt is possible to give editor commands which are ignored.This is useful when making complex editor scriptsfor which comments are desired.The comment character is the double quote: ".Any command line beginning with " is ignored.Comments beginning with " may also be placed at the endsof commands, except in cases where they could be confused as partof text (shell escapes and the substitute and map commands)..NH 2Multiple commands per line.PPMore than one command may be placed on a line by separating each pairof commands by a `|' character.However the.I globalcommands,comments,and the shell escape `!'must be the last command on a line, as they are not terminated by a `|'..NH 2Reporting large changes.PPMost commands which change the contents of the editor buffer givefeedback if the scope of the change exceeds a threshold given by the.I reportoption.This feedback helps to detect undesirably large changes so that they maybe quickly and easily reversed with an.I undo.After commands with more global effect such as.I globalor.I visual,you will be informed if the net change in the number of linesin the buffer during this command exceeds this threshold..NH 1Command addressing.NH 2Addressing primitives.IP \fB.\fR 20The current line.Most commands leave the current line as the last line which they affect.The default address for most commands is the current line,thus `\fB.\fR' is rarely used alone as an address..IP \fIn\fR 20The \fIn\fRth line in the editor's buffer, lines being numberedsequentially from 1..IP \fB$\fR 20The last line in the buffer..IP \fB%\fR 20An abbreviation for ``1,$'', the entire buffer..IP \fI+n\fR\ \fI\-n\fR 20

⌨️ 快捷键说明

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