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

📄 doc.sh

📁 操作系统源代码
💻 SH
📖 第 1 页 / 共 5 页
字号:
X.ti +0.5iX:20,30y aX.spX.LPXwill copy lines 20 through 30 into cut buffer "a.X.PPXYou can't directly put text into the ". buffer, or the "2 through "9 buffers.X.NH 2XPasting from a Cut BufferX.PPXThere are two styles of pasting:Xline-mode and character-mode.XIf a cut buffer contains whole lines (from a command like "dd")Xthen line-mode pasting is used;Xif it contains partial lines (from a command like "dw")Xthen character-mode pasting is used.XThe EX commands always cut whole lines.X.PPXCharacter-mode pasting causes the text to be inserted into the line thatXthe cursor is on.X.PPXLine-mode pasting inserts the text on a new line above or below the lineXthat the cursor is on.XIt doesn't affect the cursor's line at all.X.PPXIn visual mode, the p and P commands insert text from a cut buffer.XUppercase P will insert it before the cursor,Xand lowercase p will insert it after the cursor.XNormally, these commands will paste from the "1 buffer, but you canXspecify any other buffer to paste from.XJust type its name (a double-quote and another character)Xbefore you type the P or p.X.PPXIn EX mode, the (pu)t command pastes text after a given line.XTo paste from a buffer other that "1,Xenter its name after the command.X.NH 2XMacrosX.PPXThe contents of a named cut buffer can be executed as a series ofXex/vi commands.X.PPXTo put the instructions into the cut buffer, you must first insertXthem into the file, and then delete them into a named cut buffer.X.PPXTo execute a cut buffer's contents as EX commands,Xyou should give the EX command "@" and the name of the buffer.XFor example, :@z will execute "z as a series of EX commands.X.PPXTo execute a cut buffer's contents as visual commands,Xyou should give the visual command "@" and the letter of the buffer's name.XThe visual "@" command is different from the EX "@" command.XThey interpret the cut buffer's contents differently.X.PPXThe visual @ command can be rather finicky.XEach character in the buffer is interpretted as a keystroke.XIf you load the instructions into the cut buffer via a "zdd command,Xthen the newline character at the end of the line will be executed justXlike any other character, so the cursor would be moved down 1 line.XIf you don't want the cursor to move down 1 line at the end of eachX@z command, then you should load the cut buffer by saying 0"zD instead.X.PPXAlthough cut buffers can hold any amount of text,X\*E can only \fIexecute\fR small buffers.XThe size limit is roughly 1000 characters, for either EX macros or VI macros.XIf a buffer is too large to execute, an error message is displayed.X.PPXYou can't nest :@ commands.XYou can't run :@ commands from your .exrc file,Xor any other :source file either.XSimilarly, you can't run a :source command from within an @ command.XHopefully, these restrictions will be lifted in a later version.X.NH 2XThe Effect of Switching FilesX.PPXWhen \*E first starts up, all cut buffers are empty.XWhen you switch to a different fileX(via the :n or :e commands perhaps)Xthe 9 anonymous cut buffers are emptied again,Xbut the other 27 buffers ("a through "z, and ".) retain their text./echo x - differ.mssed '/^X/s///' > differ.ms << '/'X.Go 7 "DIFFERENCES BETWEEN \*E & BSD VI/EX"X.PPX\*E is not 100% compatible with the real vi/ex.X\*E has many small extensions, some omissions, and a few features whichXare implemented in a slightly different manner.X.NH 2XExtensionsX.IP "Save Configuration" 1iXThe :mkexrc command saves the current :set and :map configurations inXthe ".exrc" file in your current directory.X.IP "Previous File" 1iXThe :N or :prev command moves backwards through the args list.X.IP "Center Current Row" 1iXIn visual command mode, the (lowercase) "zz" command will center the currentXline on the screen, like "z=".X.IP "Changing Repeat Count" 1iXThe default count value for . is the same as the previous commandXwhich . is meant to repeat.XHowever, you can supply a new count if you wish.XFor example, after "3dw", "." will delete 3 words,Xbut "5." will delete 5 words.X.IP "Previous Text" 1iXThe text which was most recently inputX(via a "cw" command, or something similar)Xis saved in a cut buffer called ". (whichXis a pretty hard name to write in an English sentence).X.IP "Keyword Lookup" 1iXIn visual command mode, you can move the cursor onto a word and pressXshift-K to have \*E run a reference program to look that word up.XThis command alone is worth the price of admission!XSee the ctags and ref programs.X.IP "Increment/Decrement" 1iXIn visual command mode, you can move the cursor onto a number andXthen hit ## or #+ to increment that number by 1.XTo increment it by a larger amount,Xtype in the increment value before hitting the initial #.XThe number can also be decremented or set by hitting #- or #=, respectively.X.IP "Input Mode" 1iXYou can backspace past the beginning of the line.X.IP "" 1iXThe arrow keys work in input mode.X.IP "" 1iXIf you type control-A, then the text that you input last time is inserted.XYou will remain in input mode, so you can backspace over part of it,Xor add more to it.X(This is sort of like control-@ on the real vi,Xexcept that control-A really works.)X.IP "" 1iXControl-P will insert the contents of the cut buffer.X.IP "" 1iXReal vi can only remember up to 128 characters of input,Xbut \*E can remember any amount.X.IP "" 1iXThe ^T and ^D keys can adjust the indent of a line no matter whereXthe cursor happens to be in that line.X.IP "" 1iXYou can save your file and exit \*E directly from input mode by hittingXcontrol-Z twice.X.IP "" 1iX\*E supports digraphs as a way to enter non-ASCII characters.X.IP "Start in Input Mode" 1iXIf you ":set inputmode" in your .exrc file, then \*E will start up inXinput mode instead of visual command mode.X.IP "Visible Fonts" 1iXWith ":set charattr", \*E can display "backslash-f" style character attributes on theXscreen as you edit.XThe following example shows the recognized atributes:X.spX.ti +0.5iXnormal \\fBboldface\\fR \\fIitalics\\fR \\fUunderlined\\fR normalX.spXNOTE: you must compile \*E without the -DNO_CHARATTR flag forXthis to work.X.IP "File Syncing" 1iXAfter a crash, you can usually recover the altered form of the fileXfrom the temporary file that \*E uses -- unless the temporary file wasXcorrupted.X.IP "" 1iXUNIX systems use a delayed-write cache, which means that when \*E tries toXwrite to the temporary file, the information might still be in RAM insteadXof on the disk.XA power failure at that time would cause the in-RAM information to be lost.XUNIX's sync() call will force all such information to disk.X.IP "" 1iXMS-DOS and Atari TOS don't write a file's length to disk until that fileXis closed.XConsequently, the temporary file would appear to be 0 bytes long if powerXfailed when we were editing.XTo avoid this problem, a sync() function has been written which will closeXthe temporary file and then immediately reopen it.X.IP "Cursor Shape" 1iX\*E changes the shape of the cursor to indicate which mode you're in,Xif your terminal's termcap entry includes the necessary capabilities.X.IP "Hide nroff Lines" 1iXTh ":set hideformat" option hides nroff format control lines.X(They are displayed on the screen as blank lines.)X.ne 7X.IP "Compiler Interface" 1iX\*E is clever enough to parse the error messages emitted by many compilers.XTo use this feature,Xyou should collect your compiler's error messages into a file called "errlist";X\*E will read this file,Xdetermine which source file caused the error messages,Xstart editing that file,Xmove the cursor to the line where the error was detected,Xand display the error message on the status line.XNifty!X.IP "Visible Text Selection" 1iXIn visual command mode, 'v' starts visibly selecting characters andX\&'V' starts visibly selecting whole lines.XThe character or line where the cursor is located becomes oneXendpoint of the selection.XYou can then use the standard cursor movement commands to move the cursorXto the other endpoint, and then press one of the operator commandsX(c/d/y/</>/!/=/\\).XThe operator will then immediately be applied to the selected text.X.IP "Pop-up Menu Operator" 1iXThe '\\' key is a new operator,Xsimilar in operation to the c/d/y/</>/! operatorsXIt conjures up a menu, from which you can select any of the otherXoperators plus a few other common commands.X.IP "Preset Filter Operator" 1iXThe '=' key is another new operator.XIt is similar to the '!' operator, except that whileX\&'!' asks you to type in a filter command each time,X\&'=' assumes it should always run the command stored in the \fIequalprg\fR option.X.IP "Move to a Given Percentage" 1iXThe '%' movement key can now accept an optional count.XWithout a count, the '%' key still moves to a matching parenthesisXlike it always did.XWith a count somewhere between 1 and 100, though, it moves the cursor toXapproximately a given percentage of the way through the file.XFor example, typing "50%" will move the cursor to the middle of the file.X.IP "Regular Expressions"XIn regular expressions, several new forms of closure operators are supported:X\\{\fIn\fR}, \\{\fIn\fR,\fIm\fR}, \\+, and \\?.X.NH 2XOmissionsX.PPXThe replace mode is a hack.XIt doesn't save the text that it overwrites.X.PPXLong lines are displayed differently -- where the real vi wouldXwrap a long line onto several rows of the screen, \*E simplyXdisplays part of the line, and allows you to scroll the screenXsideways to see the rest of it.X.PPXThe ":preserve" and ":recover" commands are missing.XSo is the -r flag.XI've never had a good reason to use ":preserve",Xand since ":recover" is used so rarelyXI decided to implement it as a separate program.XThere's no need to load the recovery code into memory everyXtime you edit a file, I figured.X.PPXLISP support is missing.XHowever, the = key is still an operator that reformats lines of text.XBy default, it reformats lines by sending them through the \fIfmt\fP filter,Xbut you could write your own LISP beautifier and configure elvis to use it.XKey mappings could take care of most other differences.XAuto-indent is the only thing that is irrecoverably lost.X.PPXAutoindent mode acts a little different from the real vi, anyway.XIt doesn't handle ^^D or 0^D correctly.XOn the other hand, it \fIdoes\fP allow ^D and ^T to be used anywhere in theXline, to adjust the indentation for the whole line./echo x - environ.mssed '/^X/s///' > environ.ms << '/'X.Go 11 "ENVIRONMENT VARIABLES"X.PPX\*E examines several environment variables when it starts up.XThe values of these variables are used internally for a varietyXof purposes.XYou don't need to define all of these;Xon most systems, \*E only requires TERM to be defined.XOn AmigaDOS, MS-DOS or TOS systems, even that is optional.X.SHXTERM, TERMCAPX.PPXTERM tells \*E the name of the termcap entry to use.XTERMCAP may contain either the entire termcap entry,Xor the full pathname of the termcap file to search through.X.PPXIf your version of \*E is using tinytcap instead of the full termcap library,Xthen the value of TERMCAP \fIcannot\fR contain any backslash escapes (\\E, \\r, etc.)Xor carat escapes (^[, ^M, etc.), because tinytcap doesn't understand them.XInstead, you should embed the actual control character into the string.X.SHXTMP, TEMPX.PPXThese only work for AmigaDOS, MS-DOS and Atari TOS.XEither of these variables may be used to set the "directory" option,Xwhich controls where temporary files are stored.XIf you define them both, then TMP is used, and TEMP is ignored.X.SHXLINES, COLUMNSX.PPXThe termcap entry for your terminal should specify the size of your screen.XIf you're using a windowing interface, then there is an ioctl() call whichXwill provide the size of the window; the ioctl() values will override theXvalues in the termcap entry.XThe LINES and COLUMNS environment variables (if defined)Xwill override either of these sources.XThey, in turn, can be overridden by a ":set" command.X.PPXNormally, the LINES and COLUMNS variables shouldn't need to be defined.X.SHXEXINITX.PPXThis variable's value may contain one or more colon-mode commands,Xwhich will be executed after all of the ".exrc" filesXbut before interactive editing begins.X.PPXTo put more than one command in EXINIT, you can separate the commandsXwith either a newline or a '|' character.X.SHXSHELL, COMSPECX.PPXYou can use COMSPEC in MS-DOS, or SHELL in any other system,Xto specify which shell should be used for executing commands andXexpanding wildcards.X.SHXHOMEX.PPXThis variable should give the full pathname of your home directory.X\*E needs to know the name of your home directory so it can locateXthe ".exrc" file there.X.SHXTAGPATHX.PPXThis variable is used by the "ref" program.XIt contains a list of directories that might contain a relevent "tags" file.XUnder AmigaDOS, MS-DOS or Atari TOS, the names of the directories should be separated byXsemicolons (";").XUnder other operating systems, the names should be separated by colons (":").X.PPXIf you don't define TAGPATH, then "ref" will use a default list which includesXthe current directory and a few other likely places.XSee the definition of DEFTAGPATH at the start of ref.c for an accurate list./echo x - ex.mssed '/^X/s///' > ex.ms << '/'X.Go 3 "COLON MODE COMMANDS"X.IDX.psX.in 0.8iX.ta 2i 3.iX.\" NOTE: The following macro is used to output a single line of theX.\" command chart.  Its usage is:X.\"X.\"		.Cm <linespecs> <name> <arguments>...

⌨️ 快捷键说明

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