📄 elvis.9
字号:
The (y)ank command copies the specified range of lines into a cutbuffer, but does \fInot\fR delete them.The (pu)t command inserts text from a cut buffer after the specifiedline\(emor before it if the ! is present.The (co)py and (t)o commands yank the specified range of lines and thenimmediately paste them after some other line.The (m)ove command deletes the specified range of lines and thenimmediately pastes them after some other line. If the destinationline comes after the deleted text, then it will be adjustedautomatically to account for the deleted lines..UU "Displaying Text".LP.ta 1.2i 2.4i.nf[line][,line] print[line][,line] list.fiThe (p)rint command displays the specified range of lines.The (l)ist command also displays them, but it is careful to makecontrol characters visible..UU "Global Operations".LP.ta 1.2i 2.4i.nf[line][,line] global /regexp/ command[line][,line] vglobal /regexp/ command.fiThe (g)lobal command searches through the lines of the specified range(or through the whole file if no range is specified) for lines thatcontain a given regular expression. It then moves the cursor to eachof these lines and runs some other command on them.The (v)global command is similar, but it searches for lines that\fIdo not\fR contain the regular expression..UU "Line Editing".LP.ta 1.2i 2.4i.nf[line][,line] join[line][,line] ! program[line][,line] <[line][,line] >[line][,line] substitute /regexp/replacement/[p][g].fiThe (j)oin command concatenates all lines in the specified range togetherto form one big line. If only a single line is specified, then thefollowing line is catenated onto it.The ! command runs an external filter program, and feeds the specifiedrange of lines to it's stdin. The lines are then replaced by theoutput of the filter. A typical example would be \*(OQ:'a,'z!sort -n\*(CQ tosort the lines 'a,'z according to their numeric values.The < and > commands shift the specified range of lines left or right,normally by the width of 1 tab character. The \*(OQshiftwidth\*(CQ optiondetermines the shifting amount.The (s)ubstitute command finds the regular expression in each line,and replaces it with the replacement text. The \*(OQp\*(CQ option causesthe altered lines to be printed, and the \*(OQg\*(CQ option permits allinstances of the regular expression to be found & replaced. (Without\*(OQg\*(CQ, only the first occurrence is replaced.).SP 0.25.UU "Undo".SP 0.25.LP.ta 1.2i 2.4i.nf undo.fiThe (u)ndo command restores the file to the state it was in before yourmost recent command which changed text..SP 0.25.UU "Configuration & Status".SP 0.25.LP.ta 1.2i 2.4i.nf map[!] [key mapped_to] unmap[!] key set [options] mkexrc[line] mark x visual version[line][,line] = file.fiThe (ma)p command allows you to configure \fIelvis\fR to recognize yourfunction keys, and treat them as though they transmitted some othersequence of characters. Normally this mapping is done only when inthe visual command mode, but with the [!] present it will map keysunder all contexts. When this command is given with no arguments,it prints a table showing all mappings currently in effect. Whencalled with two arguments, the first is the sequence that yourfunction key really sends, and the second is the sequence that youwant \fIelvis\fR to treat it as having sent.The (unm)ap command removes key definitions that were made via themap command.The (se)t command allows you examine or set various options. Withno arguments, it displays the values of options that have beenchanged. With the single argument \*(OQall\*(CQ it displays the values ofall options, regardless of whether they've been explicitly set ornot. Otherwise, the arguments are treated as options to be set.The (mk)exrc command saves the current configuration to a filecalled \fI.exrc\fR in the current directory.The mar(k) command defines a named mark to refer to a specific placein the file. This mark may be used later to specify lines for othercommands.The (vi)sual command puts the editor into visual mode. Instead ofemulating ex, \fIelvis\fR will start emulating vi.The (ve)rsion command tells you that what version of \fIelvis\fR this is.The = command tells you what line you specified, or, if you specifieda range of lines, it will tell you both endpoints and the number oflines included in the range.The file command tells you the name of the file, whether it has beenmodified, the number of lines in the file, and the current line number..UU "Multiple Files".LP.ta 1.2i 2.4i.nf args [files] next[!] [files] Next[!] previous[!] rewind[!].fiWhen you invoke \fIelvis\fR from your shell's command line, any filenamesthat you give to \fIelvis\fR as arguments are stored in the args list. The(ar)gs command will display this list, or define a new one.The (n)ext command switches from the current file to the next one inthe args list. You may specify a new args list here, too.The (N)ext and (pre)vious commands (they're really aliases for the samecommand) switch from the current file to the preceding file in theargs list.The (rew)ind command switches from the current file to the first filein the args list..SP 1.UU "Switching Files".SP 1.LP.ta 1.2i 2.4i.nf edit[!] [file] tag[!] tagname.fiThe (e)dit command allows to switch from the current file to some otherfile. This has nothing to do with the args list, by the way.The (ta)g command looks up a given tagname in a file called \*(OQtags".This tells it which file the tag is in, and how to find it in that file.\fIElvis\fR then switches to the tag's file and finds the tag..SP 1.UU "Exiting".SP 1.LP.ta 1.2i 2.4i.nf quit[!] wq xit.fiThe (q)uit command exits from the editor without saving your file.The (wq) and (x)it commands (really two names for the same command)both write the file before exiting..UU "File I/O".LP.ta 1.2i 2.4i.nf[line] read file[line][,line] write[!][[>>]file].fiThe (r)ead command gets text from another file and inserts it afterthe specified line..fiThe (w)rite command writes the whole file, or just part of it, tosome other file. The !, if present, will permit the lines to bewritten even if you've set the readonly option. If you precede thefilename by >> then the lies will be appended to the file..UU "Directory".LP.ta 1.2i 2.4i.nf cd [directory] chdir [directory] shell.fiThe (cd) and (chd)ir commands (really two names for one command)switch the current working directory.The (sh)ell command starts an interactive shell..SP 0.5.UU "Debugging".SP 0.5.LP.ta 1.2i 2.4i.nf[line][,line] debug[!] validate[!].fiThese commands are only available if you compile \fIelvis\fR with the\fB-DDEBUG\fR flag.The de(b)ug command lists stats for the blocks which contain thespecified range of lines. If the ! is present, then the contentsof those blocks is displayed, too.The (va)lidate command checks certain variables for internalconsistency. Normally it does not output anything unless it detectsa problem. With the !, though, it will always produce *some*output..SP 0.5.SS "Extensions".SP 0.5.PP..ta 1i.in +0.25iIn addition to the standard commands, a variety of extra features arepresent in \fIelvis\fR that are not present in \fIvi\fR.They are described below..ti -0.25i.B .exrc.br\fIElvis\fR first runs a \fI.exrc\fR file (if there is one) from your $HOMEdirectory. After that, it runs a \fI.exrc\fR (if there is one) from thecurrent directory. The one in the current directory may overridesettings made by the one in the $HOME directory..ti -0.25i.B :mkexrc.ti -0.25i.B :mk.brThis EX command saves the current :set and :map configurations inthe \*(OQ.exrc\*(CQ file in your current directory..ti -0.25i.B :args.ti -0.25i.B :ar.brYou can use the :args command to define a new args list, as in: :args *.hAfter you have defined a new args list, the next time you issue a:next command \fIelvis\fR will switch to the first file of the new list..ti -0.25i.B :Next.ti -0.25i.B :previous.ti -0.25i.B :N.ti -0.25i.B :pre.brThese commands move backwards through the args list..ti -0.25i.B zz.brIn VI, the (lowercase) \*(OQzz\*(CQ command will center the current line onthe screen, like \*(OQz=".ti -0.25i.B ..brThe default count value for . is the same as the previous commandwhich . is meant to repeat. However, you can supply a new countif you wish. For example, after \*(OQ3dw\*(CQ, \*(OQ.\*(CQ will delete 3 words,but \*(OQ5.\*(CQ will delete 5 words..ti -0.25i\fB"\fR.brThe text which was most recently input (via a \*(OQcw\*(CQ command, orsomething similar) is saved in a cut buffer called ". (which is apretty hard name to write in an English sentence). You can use thiswith the \*(OQp\*(CQ or \*(OQP\*(CQ commands thusly:.HS ".p.HS.ti -0.25i.B K.brYou can move the cursor onto a word and press shift-K to have \fIelvis\fRrun a reference program to look that word up. This command alone isworth the price of admission! See the ctags and ref programs..ti -0.25i.B input.brYou can backspace back past the beginning of the line.If you type CTRL-A, then the text that you input last time isinserted. You will remain in input mode, so you can backspace overpart of it, or add more to it. (This is sort of like CTRL-@ onthe real vi, except that CTRL-A really works.)Real \fIvi\fR can only remember up to 128 characters of input, but \fIelvis\fRcan remember any amount..ti -0.25i.B :setcharattr.ti -0.25i.B :seca.br\fIElvis\fR can display \*(OQbackslash-f\*(CQ style character attributes on thescreen as you edit. The following example shows the recognizedattributes: normal \fBboldface\fR \fIitalics\fR NOTE: you must compile \fIelvis\fR without the \(enDSET_NOCHARATTR flag forthis to work..in -0.25i.SS "Omissions".PPA few \fIvi\fR features are missing.The replace mode is a hack. It does not save the text that it overwrites..PPLong lines are displayed differently\(emwhere the real vi would wrap a longline onto several rows of the screen, \fIelvis\fR simply displays part of the line,and allows you to scroll the screen sideways to see the rest of it..PPThe \*(OQ:preserve\*(CQ and \*(OQ:recover\*(CQ commands are missing, as is the \fB\(enr\fR flag.\*(OQ:Preserve" is practically never used and since use of \*(OQ:recover\\*(CQis so rare, it was decided to implement it as a separate program. There's noneed to load the recovery code into memory every time you edit a file..PPLISP support is missing.The \*(OQ@\*(CQ and \*(OQ:@\*(CQ commands are missing.You cannot APPEND to a cut buffer..SS "Options".PPA variety of options can be set as described below:.HS.nf.in +0.25i.ta 0.9i 1.35i 2.1i 3.0i\fBName Abbr Type Default Description\fRautoindent as Bool FALSE autoindent during input?autowrite aw Bool FALSE write file for :n command?charattr ca Bool FALSE display bold & underline chars?columns co Number 80 width of screen, in charactersdirectory dir String /usr/tmp where tmp files are kepterrorbells eb Bool TRUE ring bell on error?exrefresh er Bool TRUE EX mode calls write() often?ignorecase ic Bool FALSE searches: upper/lowercase OK?keytime kt Number 1 allow slow receipt of ESC seq?keywordprg kp String /usr/bin/ref program to run for shift-Klines ln Number 25 height of screen, in lineslist li Bool FALSE show tabs as \*(OQ^I\*(CQ?magic ma Bool TRUE searches: allow metacharacters?paragraphs pa String PPppPApa paragraphs start with .PP, etc.readonly ro Bool FALSE no file should be written back?report re Number 5 report changes to X lines?scroll sc Number 12 default #lines for ^U and ^Dsections se String SEseSHsh sections start with .SE, etc.shell sh String \fI/bin/sh\fR shell program, from environmentshiftwidth sw Number 8 width of < or > commandssidescroll ss Number 8 #chars to scroll sideways bysync sy Bool FALSE call sync() after each change?tabstop ts Number 8 width of a tab characterterm te String "?" terminal type, from environmentvbell vb Bool TRUE use visible bell if possible?warn wa Bool TRUE warn if file not saved for :!cmdwrapmargin wm Number 0 Insert newline after which col?wrapscan ws Bool TRUE searches: wrap at EOF?.fi.ti -0.25i.B autoindent.brDuring input mode, the autoindent option will cause each added lineto begin with the same amount of leading whitespace as the line aboveit. Without autoindent, added lines are initially empty..ti -0.25i.B autowrite.brWhen you're editing one file and decide to switch to another\(emviathe :tag command, or :next command, perhaps\(emif your currentfile has been modified, then \fIelvis\fR will normally print an errormessage and refuse to switch.However, if the autowrite option is on, then \fIelvis\fR will write themodified version of the current file and successfully switch to the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -