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

📄 ex.rm

📁 早期freebsd实现
💻 RM
📖 第 1 页 / 共 4 页
字号:
command apply here also.If the file buffer is empty and there is no current name then.I extreats this as an.I editcommand..IPAddress `0' is legal for this command and causes the file to be read atthe beginning of the buffer.Statistics are given as for the .I editcommand when the .I readsuccessfully terminates.After a.I readthe current line is the last line read.\(dd.FS\(dd Within.I openand.I visualthe current line is set to the first line read rather than the last..FE.LC( \fB.\fR ) \fBread\fR  \fB!\fR\fIcommand\fR.ZPReads the output of the command.I commandinto the buffer after the specified line.This is not a variant form of the command, rather a readspecifying a.I commandrather than a .I filename;a blank or tab before the \fB!\fR is mandatory..LC\fBrecover \fIfile\fR.ZPRecovers.I filefrom the system save area.Used after a accidental hangup of the phone**.FS** The system saves a copy of the file you were editing only if youhave made changes to the file..FEor a system crash** or.I preservecommand.Except when you use.I preserveyou will be notified by mail when a file is saved..LC\fBrewind\fR	abbr: \fBrew\fR.ZPThe argument list is rewound, and the first file in the list is edited..LC\fBrew!\fR.ZPRewinds the argument list discarding any changes made to the current buffer..LC\fBset\fR \fIparameter\fR.ZPWith no arguments, prints those options whose values have beenchanged from their defaults;with parameter.I allit prints all of the option values..IPGiving an option name followed by a `?'causes the current value of that option to be printed.The `?' is unnecessary unless the option is Boolean valued.Boolean options are given values either by the form`set \fIoption\fR' to turn them on or`set no\fIoption\fR' to turn them off;string and numeric options are assigned via the form`set \fIoption\fR=value'..IPMore than one parameter may be given to .I set \|;they are interpreted left-to-right..LC\fBshell\fR	abbr: \fBsh\fR.IPA new shell is created.When it terminates, editing resumes..LC\fBsource\fR \fIfile\fR	abbr: \fBso\fR.IPReads and executes commands from the specified file..I Sourcecommands may be nested..LC( \fB.\fR , \fB.\fR ) \fBsubstitute\fR /\fIpat\fR\|/\fIrepl\fR\|/ \fIoptions\fR \fIcount\fR \fIflags\fR	abbr: \fBs\fR.IPOn each specified line, the first instance of pattern.I patis replaced by replacement pattern.I repl.If the.I globalindicator option character `g'appears, then all instances are substituted;if the.I confirmindication character `c' appears,then before each substitution the line to be substitutedis typed with the string to be substituted markedwith `\(ua' characters.By typing an `y' one can cause the substitution to be performed,any other input causes no change to take place.After a.I substitutethe current line is the last line substituted..IPLines may be split by substitutingnew-line characters into them.The newline in.I replmust be escaped by preceding it with a `\e'.Other metacharacters available in.I patand.I replare described below..LC.B stop.ZPSuspends the editor, returning control to the top level shell.If.I autowriteis set and there are unsaved changes,a write is done first unless the form.B stop !is used.This commands is only available where supported by the teletype driverand operating system..LC( \fB.\fR , \fB.\fR ) \fBsubstitute\fR \fIoptions\fR \fIcount\fR \fIflags\fR	abbr: \fBs\fR.ZPIf.I patand.I replare omitted, then the last substitution is repeated.This is a synonym for the.B &command..LC( \fB.\fR , \fB.\fR ) \fBt\fR \fIaddr\fR \fIflags\fR.ZPThe.I tcommand is a synonym for .I copy ..LC\fBta\fR \fItag\fR.ZPThe focus of editing switches to the location of.I tag,switching to a different line in the current file where it is defined,or if necessary to another file.\(dd.FS\(dd If you have modified the current file before giving a.I tagcommand, you must write it out; giving another.I tagcommand, specifying no.I tagwill reuse the previous tag..FE.IPThe tags file is normally created by a program such as.I ctags,and consists of a number of lines with three fields separated by blanksor tabs.  The first field gives the name of the tag,the second the name of the file where the tag resides, and the thirdgives an addressing form which can be used by the editor to find the tag;this field is usually a contextual scan using `/\fIpat\fR/' to be immuneto minor changes in the file.  Such scans are always performed as if.I nomagicwas set..PPThe tag names in the tags file must be sorted alphabetically..LC\fBunabbreviate\fR \fIword\fP	abbr: \fBuna\fP.ZPDelete.I wordfrom the list of abbreviations..LC\fBundo\fR	abbr: \fBu\fR.ZPReverses the changes made in the buffer by the lastbuffer editing command.Note that.I globalcommands are considered a single command for the purpose of .I undo(as are.I openand.I visual.)Also, the commands.I writeand.I editwhich interact with thefile system cannot be undone..I Undois its own inverse..IP.I Undoalways marks the previous value of the current line `\fB.\fR'as `\'\''.After an.I undothe current line is the first line restoredor the line before the first line deleted if no lines were restored.For commands with more global effectsuch as.I globaland.I visualthe current line regains it's pre-command value after an.I undo..LC\fBunmap\fR \fIlhs\fR.ZPThe macro expansion associated by.I mapfor.I lhsis removed..LC( 1 , $ ) \fBv\fR /\fIpat\fR\|/ \fIcmds\fR.ZPA synonym for the.I globalcommand variant \fBg!\fR, running the specified \fIcmds\fR on eachline which does not match \fIpat\fR..LC\fBversion\fR	abbr: \fBve\fR.ZPPrints the current version number of the editoras well as the date the editor was last changed..LC( \fB.\fR ) \fBvisual\fR \fItype\fR \fIcount\fR \fIflags\fR	abbr: \fBvi\fR.ZPEnters visual mode at the specified line..I Typeis optional and may be `\-' , `\(ua' or `\fB.\fR'as in the.I zcommand to specify the placement of the specified line on the screen.By default, if.I typeis omitted, the specified line is placed as the first on the screen.A.I countspecifies an initial window size; the default is the value of the option.I window.See the document.I "An Introduction to Display Editing with Vi"for more details.To exit this mode, type Q..LC\fBvisual\fP file.br\fBvisual\fP +\fIn\fP file.ZPFrom visual mode,this command is the same as edit..LC( 1 , $ ) \fBwrite\fR \fIfile\fR	abbr: \fBw\fR.ZPWrites changes made back to \fIfile\fR, printing the number of lines andcharacters written.Normally \fIfile\fR is omitted and the text goes back where it came from.If a \fIfile\fR is specified, then text will be written to that file.*.FS* The editor writes to a file only if it isthe current file and is.I edited ,if the file does not exist,or if the file is actually a teletype,.I /dev/tty,.I /dev/null.Otherwise, you must give the variant form \fBw!\fR to force the write..FEIf the file does not exist it is created.The current file name is changed only if there is no current filename; the current line is never changed..IPIf an error occurs while writing the current and.I editedfile, the editorconsiders that there has been ``No write since last change''even if the buffer had not previously been modified..LC( 1 , $ ) \fBwrite>>\fR \fIfile\fR	abbr: \fBw>>\fR.ZPWrites the buffer contents at the end ofan existing file..IP.LC\fBw!\fR \fIname\fR.ZPOverrides the checking of the normal \fIwrite\fR command,and will write to any file which the system permits..LC( 1 , $ ) \fBw\fR  \fB!\fR\fIcommand\fR.ZPWrites the specified lines into .I command.Note the difference between \fBw!\fR which overrides checks and\fBw\ \ !\fR which writes to a command..LC\fBwq\fR \fIname\fR.ZPLike a \fIwrite\fR and then a \fIquit\fR command..LC\fBwq!\fR \fIname\fR.ZPThe variant overrides checking on the sensibility of the.I writecommand, as \fBw!\fR does..LC\fBxit\fP \fIname\fR.ZPIf any changes have been made and not written, writes the buffer out.Then, in any case, quits..LC( \fB.\fR , \fB.\fR )\|\fByank\fR \fIbuffer\fR \fIcount\fR	abbr: \fBya\fR.ZPPlaces the specified lines in the named.I buffer,for later retrieval via.I put.If no buffer name is specified, the lines go to a more volatile place;see the \fIput\fR command description..LC( \fB.+1\fR ) \fBz\fR \fIcount\fR.ZPPrint the next \fIcount\fR lines, default \fIwindow\fR..LC( \fB.\fR ) \fBz\fR \fItype\fR \fIcount\fR.ZPPrints a window of text with the specified line at the top.If \fItype\fR is `\-' the line is placed at the bottom; a `\fB.\fR' causesthe line to be placed in the center.*A count gives the number of lines to be displayed rather thandouble the number specified by the \fIscroll\fR option.On a \s-2CRT\s0 the screen is cleared before display begins unless acount which is less than the screen size is given.The current line is left at the last line printed..FS* Forms `z=' and `z\(ua' also exist; `z=' places the current line in thecenter, surrounds it with lines of `\-' characters and leaves the currentline at this line.  The form `z\(ua' prints the window before `z\-'would.  The characters `+', `\(ua' and `\-' may be repeated for cumulativeeffect.On some v2 editors, no.I typemay be given..FE.LC\fB!\fR \fIcommand\fR\fR.ZPThe remainder of the line after the `!' character is sent to a shellto be executed.Within the text of.I commandthe characters `%' and `#' are expanded as in filenames and the character`!' is replaced with the text of the previous command.Thus, in particular,`!!' repeats the last such shell escape.If any such expansion is performed, the expanded line will be echoed.The current line is unchanged by this command..IPIf there has been ``[No\ write]'' of the buffer contents since the lastchange to the editing buffer, then a diagnostic will be printedbefore the command is executed as a warning.A single `!' is printed when the command completes..LC( \fIaddr\fR , \fIaddr\fR ) \fB!\fR \fIcommand\fR\fR.ZPTakes the specified address range and supplies it asstandard input to.I command;the resulting output then replaces the input lines..LC( $ ) \fB=\fR.ZPPrints the line number of theaddressed line.The current line is unchanged..KS.LC( \fB.\fR , \fB.\fR ) \fB>\fR \fIcount\fR \fIflags\fR.br( \fB.\fR , \fB.\fR ) \fB<\fR \fIcount\fR \fIflags\fR.IPPerform intelligent shifting on the specified lines;\fB<\fR shifts left and \fB>\fR shift right.The quantity of shift is determined by the.I shiftwidthoption and the repetition of the specification character.Only white space (blanks and tabs) is shifted;no non-white characters are discarded in a left-shift.The current line becomes the last line which changed due to theshifting..KE.LC\fB^D\fR.ZPAn end-of-file from a terminal input scrolls through the file.The.I scrolloption specifies the size of the scroll, normally a half screen of text..LC( \fB.\fR+1 , \fB.\fR+1 ).br( \fB.\fR+1 , \fB.\fR+1 ) |.ZPAn address alone causes the addressed lines to be printed.A blank line prints the next line in the file..LC( \fB.\fR , \fB.\fR ) \fB&\fR \fIoptions\fR \fIcount\fR \fIflags\fR.ZPRepeats the previous.I substitutecommand..LC( \fB.\fR , \fB.\fR ) \fB\s+2~\s0\fR \fIoptions\fR \fIcount\fR \fIflags\fR.ZPReplaces the previous regular expression with the previousreplacement pattern from a substitution..NH 1Regular expressions and substitute replacement patterns.NH 2Regular expressions.PPA regular expression specifies a set of strings of characters.A member of this set of strings is said to be.I matchedby the regular expression..I Exremembers two previous regular expressions:the previous regular expression used in a.I substitutecommandand the previous regular expression used elsewhere(referred to as the previous \fIscanning\fR regular expression.)The previous regular expressioncan always be referred to by a null \fIre\fR, e.g. `//' or `??'..NH 2Magic and nomagic.PPThe regular expressions allowed by.I ex are constructed in one of two ways depending on the setting ofthe.I magicoption.The.I exand.I videfault setting of.I magicgives quick access to a powerful set of regular expressionmetacharacters.The disadvantage of.I magicis that the user must remember that these metacharacters are.I magicand precede them with the character `\e'to use them as ``ordinary'' characters.With.I nomagic,the default for.I edit,regular expressions are much simpler,there being only two metacharacters.The power of the other metacharacters is still available by precedingthe (now) ordinary character with a `\e'.Note that `\e' is thus always a metacharacter..PPThe remainder of the discussion of regular expressions assumesthatthat the setting of this option is.I magic.\(dg.FS\(dg To discern what is true with.I nomagicit suffices to remember that the onlyspecial characters in this case will be `\(ua' at the beginningof a regular expression,`$' at the end of a regular expression,and `\e'.With.I nomagicthe characters `\s+2~\s0' and `&' also lose their special meaningsrelated to the replacement pattern of a substitute..FE.NH 2Basic regular expression summary.PPThe following basic constructs are used to construct.I magicmode regular expressions..IP \fIchar\fR 15An ordinary character matches itself.The characters `\(ua' at the beginning of a line,`$' at the end of line,`*' as any character other than the first,`.', `\e', `[', and `\s+2~\s0' are not ordinary characters andmust be escaped (preceded) by `\e' to be treated as such..IP \fB\(ua\fRAt the beginning of a patternforces the match to succeed only at the beginning of a line..IP \fB$\fRAt the end of a regular expression forces the match tosucceed only at the end of the line..IP \&\fB.\fRMatches any single character exceptthe new-line character..IP \fB\e<\fRForces the matchto occur only at the beginning of a ``variable'' or ``word'';that is, either at the beginning of a line, or just beforea letter, digit, or underline and after a character not one ofthese..IP \fB\e>\fRSimilar to `\e<', but matching the end of a ``variable''or ``word'', i.e. either the end of the line or before characterwhich is neither a letter, nor a digit, nor the underline character..IP \fB[\fIstring\fR]\fRMatches any (single) character in the class defined by.I string.Most characters in.I stringdefine themselves.A pair of characters separated by `\-' in.I stringdefines the set of characters collating between the specified lower and upperbounds, thus `[a\-z]' as a regular expression matchesany (single) lower-case letter.If the first character of.I stringis an `\(ua' then the constructmatches those characters which it otherwise would not;thus `[\(uaa\-z]' matches anything but a lower-case letter (and of course anewline).To place any of the characters

⌨️ 快捷键说明

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