VVii CCoommmmaanndd && FFuunnccttiioonn RReeffeerreennccee _A_l_a_n _P_._W_. _H_e_w_e_t_t _R_e_v_i_s_e_d _f_o_r _v_e_r_s_i_o_n _2_._1_2 _b_y _M_a_r_k _H_o_r_t_o_n 11.. AAuutthhoorr''ss DDiissccllaaiimmeerr This document does not claim to be 100% complete. There are a few commands listed in the original document that I was unable to test either because I do not speak lliisspp, because they required programs we don't have, or because I wasn't able to make them work. In these cases I left the command out. The commands listed in this document have been tried and are known to work. It is expected that prospective users of this document will read it once to get the flavor of everything that vvii can do and then use it as a reference document. Experimentation is recommended. If you don't understand a command, try it and see what happens. [Note: In revising this document, I have attempted to make it completely reflect version 2.12 of vvii. It does not attempt to document the VAX version (version 3), but with one or two excep- tions (wrapmargin, arrow keys) everything said about 2.12 should apply to 3.1. _M_a_r_k _H_o_r_t_o_n] 22.. NNoottaattiioonn [[ooppttiioonn]] is used to denote optional parts of a command. Many vvii commands have an optional count. [[ccnntt]] means that an optional number may precede the command to multiply or iterate the com- mand. {{vvaarriiaabbllee iitteemm}} is used to denote parts of the command which must appear, but can take a number of different values. <> means that the character or one of the characters in the range described between the two angle brackets is to be typed. For example <> means the eessccaappee key is to be typed. <> means that a lower case letter is to be typed. ^^<> means that the character is to be typed as a ccoonnttrrooll character, that is, with the <> key held down while simulta- neously typing the specified character. In this document control characters will be denoted using the _u_p_p_e_r _c_a_s_e character, but ^ and ^ are equivalent. That is, for example, <<^^DD>> is equal to <<^^dd>>. The most common character abbreviations used in this list are as follows: escape, octal 033 carriage return, ^M, octal 015 linefeed ^J, octal 012 -2- newline, ^J, octal 012 (same as linefeed) backspace, ^H, octal 010 tab, ^I, octal 011 bell, ^G, octal 07 formfeed, ^L, octal 014 space, octal 040 delete, octal 0177 33.. BBaassiiccss To run vvii the shell variable TTEERRMM must be defined and exported to your environment. How you do this depends on which shell you are using. You can tell which shell you have by the character it prompts you for commands with. The Bourne shell prompts with `$', and the C shell prompts with `%'. For these examples, we will suppose that you are using an HP 2621 terminal, whose term- cap name is ``2621''. 33..11.. BBoouurrnnee SShheellll To manually set your terminal type to 2621 you would type: TERM=2621 export TERM There are various ways of having this automatically or semi- automatically done when you log in. Suppose you usually dial in on a 2621. You want to tell this to the machine, but still have it work when you use a hardwired terminal. The recommended way, if you have the ttsseett program, is to use the sequence tset -s -d 2621 > tset$$ . tset$$ rm tset$$ in your .login (for csh) or the same thing using `.' instead of `source' in your .profile (for sh). The above line says that if you are dialing in you are on a 2621, but if you are on a hard- wired terminal it figures out your terminal type from an on-line list. 33..22.. TThhee CC SShheellll To manually set your terminal type to 2621 you would type: -3- setenv TERM 2621 There are various ways of having this automatically or semi- automatically done when you log in. Suppose you usually dial in on a 2621. You want to tell this to the machine, but still have it work when you use a hardwired terminal. The recommended way, if you have the ttsseett program, is to use the sequence tset -s -d 2621 > tset$$ source tset$$ rm tset$$ in your .login.* The above line says that if you are dialing in you are on a 2621, but if you are on a hardwired terminal it fig- ures out your terminal type from an on-line list. 44.. NNoorrmmaall CCoommmmaannddss VVii is a visual editor with a window on the file. What you see on the screen is vvii's current notion of what your file will contain, (at this point in the file), when it is written out. Most com- mands do not cause any change in the screen until the complete command is typed. Should you get confused while typing a com- mand, you can abort the command by typing an character. You will know you are back to command level when you hear a . Usually typing an will produce the same result. When vvii gets an improperly formatted command it rings the . Following are the vvii commands broken down by function. 44..11.. EEnnttrryy aanndd EExxiitt To enter vvii on a particular _f_i_l_e, type vvii _f_i_l_e The file will be read in and the cursor will be placed at the beginning of the first line. The first screenfull of the file will be displayed on the terminal. To get out of the editor, type ZZ If you are in some special mode, such as input mode or the middle of a multi-keystroke command, it may be necessary to type first. ----------- * On a version 6 system without environments, the invocation of tset is simpler, just add the line ``tset -d 2621'' to your .login or .profile. -4- 44..22.. CCuurrssoorr aanndd PPaaggee MMoottiioonn NNOOTTEE:: The arrow keys (see the next four commands) on certain kinds of terminals will not work with the PDP-11 version of vi. The control versions or the hjkl versions will work on any termi- nal. Experienced users prefer the hjkl keys because they are always right under their fingers. Beginners often prefer the arrow keys, since they do not require memorization of which hjkl key is which. The mnemonic value of hjkl is clear from looking at the keyboard of an adm3a. [cnt] or [cnt]h or [cnt]<- Move the cursor to the left one character. Cur- sor stops at the left margin of the page. If cnt is given, these commands move that many spaces. [cnt]^N or [cnt]j or [cnt]|v or [cnt] Move down one line. Moving off the screen scrolls the window to force a new line onto the screen. Mnemonic: NNext [cnt]^P or [cnt]k or [cnt]|^ Move up one line. Moving off the top of the screen forces new text onto the screen. Mnemonic: PPrevious [cnt] or [cnt]l or [cnt]-> Move to the right one character. Cursor will not go beyond the end of the line. [cnt]- Move the cursor up the screen to the beginning of the next line. Scroll if necessary. [cnt]+ or [cnt] Move the cursor down the screen to the beginning of the next line. Scroll up if necessary. [cnt]$ Move the cursor to the end of the line. If there is a count, move to the end of the line "cnt" lines forward in the file. ^ Move the cursor to the beginning of the first word on the line. 0 Move the cursor to the left margin of the current line. [cnt]| Move the cursor to the column specified by the count. The default is column zero. [cnt]w Move the cursor to the beginning of the next word. If there is a count, then move forward that -5- many words and position the cursor at the begin- ning of the word. Mnemonic: next-wword [cnt]W Move the cursor to the beginning of the next word which follows a "white space" (,, or ). Ignore other punctuation. [cnt]b Move the cursor to the preceding word. Mnemonic: bbackup-word [cnt]B Move the cursor to the preceding word that is separated from the current word by a "white space" (,, or ). [cnt]e Move the cursor to the end of the current word or the end of the "cnt"'th word hence. Mnemonic: eend-of-word [cnt]E Move the cursor to the end of the current word which is delimited by "white space" (,, or ). [line number]G Move the cursor to the line specified. Of par- ticular use are the sequences "1G" and "G", which move the cursor to the beginning and the end of the file respectively. Mnemonic: GGo-to NNOOTTEE:: The next four commands (^D, ^U, ^F, ^B) are not true motion commands, in that they cannot be used as the object of commands such as delete or change. [cnt]^D Move the cursor down in the file by "cnt" lines (or the last "cnt" if a new count isn't given. The initial default is half a page.) The screen is simultaneously scrolled up. Mnemonic: DDown [cnt]^U Move the cursor up in the file by "cnt" lines. The screen is simultaneously scrolled down. Mnemonic: UUp [cnt]^F Move the cursor to the next page. A count moves that many pages. Two lines of the previous page are kept on the screen for continuity if possi- ble. Mnemonic: FForward-a-page [cnt]^B Move the cursor to the previous page. Two lines of the current page are kept if possible. Mnemonic: BBackup-a-page [cnt]( Move the cursor to the beginning of the next sen- tence. A sentence is defined as ending with a ".", "!", or "?" followed by two spaces or a . -6- [cnt]) Move the cursor backwards to the beginning of a sentence. [cnt]} Move the cursor to the beginning of the next paragraph. This command works best inside nnrrooffff documents. It understands two sets of nnrrooffff macros, --mmss and --mmmm, for which the commands ".IP", ".LP", ".PP", ".QP", "P", as well as the nroff command ".bp" are considered to be para- graph delimiters. A blank line also delimits a paragraph. The nnrrooffff macros that it accepts as paragraph delimiters is adjustable. See ppaarraa-- ggrraapphhss under the SSeett CCoommmmaannddss section. [cnt]{ Move the cursor backwards to the beginning of a paragraph. ]] Move the cursor to the next "section", where a section is defined by two sets of nnrrooffff macros, --mmss and --mmmm, in which ".NH", ".SH", and ".H" delimit a section. A line beginning with a sequence, or a line beginning with a "{" are also considered to be section delimiters. The last option makes it useful for finding the beginnings of C functions. The nnrrooffff macros that are used for section delimiters can be adjusted. See sseeccttiioonnss under the SSeett CCoommmmaannddss section. [[ Move the cursor backwards to the beginning of a section. % Move the cursor to the matching parenthesis or brace. This is very useful in C or lisp code. If the cursor is sitting on a (( )) {{ or }} the cur- sor is moved to the matching character at the other end of the section. If the cursor is not sitting on a brace or a parenthesis, vvii searches forward until it finds one and then jumps to the match mate. [cnt]H If there is no count move the cursor to the top left position on the screen. If there is a count, then move the cursor to the beginning of the line "cnt" lines from the top of the screen. Mnemonic: HHome [cnt]L If there is no count move the cursor to the beginning of the last line on the screen. If there is a count, then move the cursor to the beginning of the line "cnt" lines from the bottom of the screen. Mnemonic: LLast M Move the cursor to the beginning of the middle line on the screen. Mnemonic: MMiddle -7- m This command does not move the cursor, but it mmaarrkkss the place in the file and the character "" becomes the label for referring to this location in the file. See the next two commands. Mnemonic: mmark NNOOTTEE:: The mark command is not a motion, and cannot be used as the target of com- mands such as delete. ' Move the cursor to the beginning of the line that is marked with the label "". ` Move the cursor to the exact position on the line that was marked with with the label "". '' Move the cursor back to the beginning of the line where it was before the last "non-relative" move. A "non-relative" move is something such as a search or a jump to a specific line in the file, rather than moving the cursor or scrolling the screen. `` Move the cursor back to the exact spot on the line where it was located before the last "non- relative" move. 44..33.. SSeeaarrcchheess The following commands allow you to search for items in a file. [cnt]f{chr} Search forward on the line for the next or "cnt"'th occurrence of the character "chr". The cursor is placed aatt the character of interest. Mnemonic: ffind character [cnt]F{chr} Search backwards on the line for the next or "cnt"'th occurrence of the character "chr". The cursor is placed aatt the character of interest. [cnt]t{chr} Search forward on the line for the next or "cnt"'th occurrence of the character "chr". The cursor is placed jjuusstt pprreecceeddiinngg the character of interest. Mnemonic: move cursor up tto character [cnt]T{chr} Search backwards on the line for the next or "cnt"'th occurrence of the character "chr". The cursor is placed jjuusstt pprreecceeddiinngg the character of -8- interest. [cnt]; Repeat the last "f", "F", "t" or "T" command. [cnt], Repeat the last "f", "F", "t" or "T" command, but in the opposite search direction. This is useful if you overshoot. [cnt]/[string]/ Search forward for the next occurrence of "string". Wrap around at the end of the file does occur. The final <> is not required. [cnt]?[string]? Search backwards for the next occurrence of "string". If a count is specified, the count becomes the new window size. Wrap around at the beginning of the file does occur. The final <> is not required. n Repeat the last /[string]/ or ?[string]? search. Mnemonic: nnext occurrence. N Repeat the last /[string]/ or ?[string]? search, but in the reverse direction. :g/[string]/[editor command] Using the :: syntax it is possible to do global searches ala the standard UNIX "ed" editor. 44..44.. TTeexxtt IInnsseerrttiioonn The following commands allow for the insertion of text. All mul- ticharacter text insertions are terminated with an charac- ter. The last change can always be uunnddoonnee by typing a uu. The text insert in insertion mode can contain newlines. a{text} Insert text immediately following the cursor position. Mnemonic: aappend A{text} Insert text at the end of the current line. Mnemonic: AAppend i{text} Insert text immediately preceding the cursor position. Mnemonic: iinsert I{text} Insert text at the beginning of the current line. o{text} Insert a new line after the line on which the cursor appears and insert text there. Mnemonic: oopen new line -9- O{text} Insert a new line preceding the line on which the cursor appears and insert text there. 44..55.. TTeexxtt DDeelleettiioonn The following commands allow the user to delete text in various ways. All changes can always be uunnddoonnee by typing the uu command. [cnt]x Delete the character or characters starting at the cursor position. [cnt]X Delete the character or characters starting at the character preceding the cursor position. D Deletes the remainder of the line starting at the cursor. Mnemonic: DDelete the rest of line [cnt]d{motion} Deletes one or more occurrences of the specified motion. Any motion from sections 4.1 and 4.2 can be used here. The d can be stuttered (e.g. [cnt]dd) to delete cnt lines. 44..66.. TTeexxtt RReeppllaacceemmeenntt The following commands allow the user to simultaneously delete and insert new text. All such actions can be uunnddoonnee by typing uu following the command. r Replaces the character at the current cursor position with . This is a one character replacement. No is required for termina- tion. Mnemonic: rreplace character R{text} Starts overlaying the characters on the screen with whatever you type. It does not stop until an is typed. [cnt]s{text} Substitute for "cnt" characters beginning at the current cursor position. A "$" will appear at the position in the text where the "cnt"'th char- acter appears so you will know how much you are erasing. Mnemonic: ssubstitute [cnt]S{text} Substitute for the entire current line (or lines). If no count is given, a "$" appears at the end of the current line. If a count of more than 1 is given, all the lines to be replaced are deleted before the insertion begins. [cnt]c{motion}{text} Change the specified "motion" by replacing it -10- with the insertion text. A "$" will appear at the end of the last item that is being deleted unless the deletion involves whole lines. Motion's can be any motion from sections 4.1 or 4.2. Stuttering the c (e.g. [cnt]cc) changes cnt lines. 44..77.. MMoovviinngg TTeexxtt VVii provides a number of ways of moving chunks of text around. There are nine buffers into which each piece of text which is deleted or "yanked" is put in addition to the "undo" buffer. The most recent deletion or yank is in the "undo" buffer and also usually in buffer 1, the next most recent in buffer 2, and so forth. Each new deletion pushes down all the older deletions. Deletions older than 9 disappear. There is also a set of named registers, a-z, into which text can optionally be placed. If any delete or replacement type command is preceded by ""<>, that named buffer will contain the text deleted after the command is executed. For example, ""aa33dddd will delete three lines starting at the current line and put them in buffer ""aa.* There are two more basic commands and some variations useful in getting and putting text into a file. ["][cnt]y{motion} Yank the specified item or "cnt" items and put in the "undo" buffer or the specified buffer. The variety of "items" that can be yanked is the same as those that can be deleted with the "d" command or changed with the "c" command. In the same way that "dd" means delete the current line and "cc" means replace the current line, "yy" means yank the current line. ["][cnt]Y Yank the current line or the "cnt" lines starting from the current line. If no buffer is speci- fied, they will go into the "undo" buffer, like any delete would. It is equivalent to "yy". Mnemonic: YYank ["]p Put "undo" buffer or the specified buffer down aafftteerr the cursor. If whole lines were yanked or deleted into the buffer, then they will be put down on the line following the line the cursor is on. If something else was deleted, like a word or sentence, then it will be inserted immediately following the cursor. Mnemonic: pput buffer ----------- * Referring to an upper case letter as a buffer name (A-Z) is the same as referring to the lower case letter, except that text placed in such a buffer is appended to it instead of replacing it. -11- It should be noted that text in the named buffers remains there when you start editing a new file with the ::ee ffiillee<> command. Since this is so, it is possible to copy or delete text from one file and carry it over to another file in the buffers. However, the undo buffer and the abil- ity to undo are lost when changing files. ["]P Put "undo" buffer or the specified buffer down bbeeffoorree the cursor. If whole lines where yanked or deleted into the buffer, then they will be put down on the line preceding the line the cursor is on. If something else was deleted, like a word or sentence, then it will be inserted immediately preceding the cursor. [cnt]>{motion} The shift operator will right shift all the text from the line on which the cursor is located to the line where the mmoottiioonn is located. The text is shifted by one sshhiiffttwwiiddtthh. (See section 6.) >>>> means right shift the current line or lines. [cnt]<{motion} The shift operator will left shift all the text from the line on which the cursor is located to the line where the iitteemm is located. The text is shifted by one sshhiiffttwwiiddtthh. (See section 6.) <<<< means left shift the current line or lines. Once the line has reached the left margin it is not further affected. [cnt]={motion} Prettyprints the indicated area according to lliisspp conventions. The area should be a lisp s-expres- sion. 44..88.. MMiisscceellllaanneeoouuss CCoommmmaannddss VVii has a number of miscellaneous commands that are very useful. They are: ZZ This is the normal way to exit from vi. If any changes have been made, the file is written out. Then you are returned to the shell. ^L Redraw the current screen. This is useful if someone "write"s you while you are in "vi" or if for any reason garbage gets onto the screen. ^R On dumb terminals, those not having the "delete line" function (the vt100 is such a terminal), vvii saves redrawing the screen when you delete a line by just marking the line with an "@" at the beginning and blanking the line. If you want to actually get rid of the lines marked with "@" and see what the page looks like, typing a ^R will do -12- this. . "Dot" is a particularly useful command. It repeats the last text modifying command. There- fore you can type a command once and then to another place and repeat it by just typing ".". u Perhaps the most important command in the editor, u undoes the last command that changed the buffer. Mnemonic: uundo U Undo all the text modifying commands performed on the current line since the last time you moved onto it. [cnt]J Join the current line and the following line. The is deleted and the two lines joined, usually with a space between the end of the first line and the beginning of what was the second line. If the first line ended with a "period", then two spaces are inserted. A count joins the next cnt lines. Mnemonic: JJoin lines Q Switch to eexx editing mode. In this mode vvii will behave very much like eedd. The editor in this mode will operate on single lines normally and will not attempt to keep the "window" up to date. Once in this mode it is also possible to switch to the ooppeenn mode of editing. By entering the command [[lliinnee nnuummbbeerr]]ooppeenn<> you enter this mode. It is similar to the normal visual mode except the window is only oonnee line long. Mnemonic: QQuit visual mode ^] An abbreviation for a tag command. The cursor should be positioned at the beginning of a word. That word is taken as a tag name, and the tag with that name is found as if it had been typed in a :tag command. [cnt]!{motion}{UNIX cmd} Any UNIX filter (e.g. command that reads the standard input and outputs something to the stan- dard output) can be sent a section of the current file and have the output of the command replace the original text. Useful examples are programs like ccbb, ssoorrtt, and nnrrooffff. For instance, using ssoorrtt it would be possible to sort a section of the current file into a new list. Using !!!! means take a line or lines starting at the line the cursor is currently on and pass them to the UNIX command. NNOOTTEE:: To just escape to the shell for one command, use :!{cmd}, see section 5. -13- z{cnt} This resets the current window size to "cnt" lines and redraws the screen. 44..99.. SSppeecciiaall IInnsseerrtt CChhaarraacctteerrss There are some characters that have special meanings during insert modes. They are: ^V During inserts, typing a ^V allows you to quote control characters into the file. Any character typed after the ^V will be inserted into the file. [^]^D or [0]^D <^D> without any argument backs up one sshhiiffttwwiiddtthh. This is necessary to remove indenta- tion that was inserted by the aauuttooiinnddeenntt feature. ^<^D> temporarily removes all the autoindenta- tion, thus placing the cursor at the left margin. On the next line, the previous indent level will be restored. This is useful for putting "labels" at the left margin. 0<^D> says remove all autoindents and stay that way. Thus the cursor moves to the left margin and stays there on suc- cessive lines until 's are typed. As with the , the <^D> is only effective before any other "non-autoindent" controlling characters are typed. Mnemonic: DDelete a shiftwidth ^W If the cursor is sitting on a word, <^W> moves the cursor back to the beginning of the word, thus erasing the word from the insert. Mnemonic: erase WWord The backspace always serves as an erase during insert modes in addition to your normal "erase" character. To insert a into your file, use the <^V> to quote it. 55.. :: Commands Typing a ":" during command mode causes vvii to put the cursor at the bottom on the screen in preparation for a command. In the ":" mode, vvii can be given most eedd commands. It is also from this mode that you exit from vvii or switch to different files. All commands of this variety are terminated by a , , or . :w[!] [file] Causes vvii to write out the current text to the disk. It is written to the file you are editing unless "file" is supplied. If "file" is sup- plied, the write is directed to that file instead. If that file already exists, vvii will not perform the write unless the "!" is supplied indicating you _r_e_a_l_l_y want to destroy the older -14- copy of the file. :q[!] Causes vvii to exit. If you have modified the file you are looking at currently and haven't written it out, vvii will refuse to exit unless the "!" is supplied. :e[!] [+[cmd]] [file] Start editing a new file called "file" or start editing the current file over again. The command ":e!" says "ignore the changes I've made to this file and start over from the beginning". It is useful if you really mess up the file. The optional "+" says instead of starting at the beginning, start at the "end", or, if "cmd" is supplied, execute "cmd" first. Useful cases of this are where cmd is "n" (any integer) which starts at line number n, and "/text", which searches for "text" and starts at the line where it is found. ^^ Switch back to the place you were before your last tag command. If your last tag command stayed within the file, ^^ returns to that tag. If you have no recent tag command, it will return to the same place in the previous file that it was showing when you switched to the current file. :n[!] Start editing the next file in the argument list. Since vvii can be called with multiple file names, the ":n" command tells it to stop work on the current file and switch to the next file. If the current file was modifies, it has to be written out before the ":n" will work or else the "!" must be supplied, which says discard the changes I made to the current file. :n[!] file [file file ...] Replace the current argument list with a new list of files and start editing the first file in this new list. :r file Read in a copy of "file" on the line after the cursor. :r !cmd Execute the "cmd" and take its output and put it into the file after the current line. :!cmd Execute any UNIX shell command. -15- :ta[!] tag VVii looks in the file named ttaaggss in the current directory. TTaaggss is a file of lines in the for- mat: tag filename vvii-search-command If vvii finds the tag you specified in the ::ttaa com- mand, it stops editing the current file if neces- sary and if the current file is up to date on the disk and switches to the file specified and uses the search pattern specified to find the "tagged" item of interest. This is particularly useful when editing multi-file C programs such as the operating system. There is a program called ccttaaggss which will generate an appropriate ttaaggss file for C and f77 programs so that by saying ::ttaa ffuunnccttiioonn<> you will be switched to that func- tion. It could also be useful when editing multi-file documents, though the ttaaggss file would have to be generated manually. 66.. SSppeecciiaall AArrrraannggeemmeennttss ffoorr SSttaarrttuupp VVii takes the value of $$TTEERRMM and looks up the characteristics of that terminal in the file //eettcc//tteerrmmccaapp. If you don't know vvii's name for the terminal you are working on, look in //eettcc//tteerrmm-- ccaapp. When vvii starts, it attempts to read the variable EXINIT from your environment.* If that exists, it takes the values in it as the default values for certain of its internal constants. See the section on "Set Values" for further details. If EXINIT doesn't exist you will get all the normal defaults. Should you inadvertently hang up the phone while inside vvii, or should the computer crash, all may not be lost. Upon return- ing to the system, type: vi -r file This will normally recover the file. If there is more than one temporary file for a specific file name, vvii recovers the newest one. You can get an older version by recovering the file more than once. The command "vi -r" without a file name gives you the list of files that were saved in the last system crash (but _n_o_t the file just saved when the phone was hung up). 77.. SSeett CCoommmmaannddss VVii has a number of internal variables and switches which can be set to achieve special affects. These options come in three ----------- * On version 6 systems Instead of EXINIT, put the startup com- mands in the file .exrc in your home directory. -16- forms, those that are switches, which toggle from off to on and back, those that require a numeric value, and those that require an alphanumeric string value. The toggle options are set by a command of the form: :set option and turned off with the command: :set nooption Commands requiring a value are set with a command of the form: :set option=value To display the value of a specific option type: :set option? To display only those that you have changed type: :set and to display the long table of all the settable parameters and their current values type: :set all Most of the options have a long form and an abbreviation. Both are listed in the following table as well as the normal default value. To arrange to have values other than the default used every time you enter vvii, place the appropriate sseett command in EXINIT in your environment, e.g. EXINIT='set ai aw terse sh=/bin/csh' export EXINIT or setenv EXINIT 'set ai aw terse sh=/bin/csh' for sshh and ccsshh, respectively. These are usually placed in your .profile or .login. If you are running a system without environ- ments (such as version 6) you can place the set command in the file .exrc in your home directory. autoindent ai Default: noai Type: toggle When in autoindent mode, vi helps you indent code by starting each line in the same column as the preceding line. Tabbing to the right with or <^T> will move this boundary to the right, and -17- it can be moved to the left with <^D>. autoprint ap Default: ap Type: toggle Causes the current line to be printed after each ex text modifying command. This is not of much interest in the normal vvii visual mode. autowrite aw Default: noaw type: toggle Autowrite causes an automatic write to be done if there are unsaved changes before certain commands which change files or otherwise interact with the outside world. These commands are :!, :tag, :next, :rewind, ^^, and ^]. beautify bf Default: nobf Type: toggle Causes all control characters except , , and to be discarded. directory dir Default: dir=/tmp Type: string This is the directory in which vvii puts its tempo- rary file. errorbells eb Default: noeb Type: toggle Error messages are preceded by a . hardtabs ht Default: hardtabs=8 Type: numeric This option contains the value of hardware tabs in your terminal, or of software tabs expanded by the Unix system. ignorecase ic Default: noic Type: toggle All upper case characters are mapped to lower case in regular expression matching. lisp Default: nolisp Type: toggle Autoindent for lliisspp code. The commands (( )) [[[[ and ]]]] are modified appropriately to affect s- expressions and functions. list Default: nolist Type: toggle All printed lines have the and charac- ters displayed visually. magic Default: magic Type: toggle Enable the metacharacters for matching. These include .. ** << >> [[ssttrriinngg]] [[^^ssttrriinngg]] and [[<>--<>]]. number nu Default: nonu Type: toggle Each line is displayed with its line number. open Default: open Type: toggle When set, prevents entering open or visual modes from ex or edit. Not of interest from vi. -18- optimize opt Default: opt Type: toggle Basically of use only when using the eexx capabili- ties. This option prevents automatic s from taking place, and speeds up output of indented lines, at the expense of losing typeahead on some versions of UNIX. paragraphs para Default: para=IPLPPPQPP bp Type: string Each pair of characters in the string indicate nnrrooffff macros which are to be treated as the beginning of a paragraph for the {{ and }} com- mands. The default string is for the --mmss and --mmmm macros. To indicate one letter nnrrooffff macros, such as ..PP or ..HH, quote a space in for the second character position. For example: :set paragraphs=P\ bp would cause vvii to consider ..PP and ..bbpp as para- graph delimiters. prompt Default: prompt Type: toggle In eexx command mode the prompt character :: will be printed when eexx is waiting for a command. This is not of interest from vi. redraw Default: noredraw Type: toggle On dumb terminals, force the screen to always be up to date, by sending great amounts of output. Useful only at high speeds. report Default: report=5 Type: numeric This sets the threshold for the number of lines modified. When more than this number of lines are modified, removed, or yanked, vvii will report the number of lines changed at the bottom of the screen. scroll Default: scroll={1/2 window} Type: numeric This is the number of lines that the screen scrolls up or down when using the <^U> and <^D> commands. sections Default: sections=SHNHH HU Type: string Each two character pair of this string specify nnrrooffff macro names which are to be treated as the beginning of a section by the ]]]] and [[[[ commands. The default string is for the --mmss and --mmmm macros. To enter one letter nnrrooffff macros, use a quoted space as the second character. See ppaarraaggrraapphhss for a fuller explanation. shell sh Default: sh=from environment SHELL or /bin/sh Type: string -19- This is the name of the sshh to be used for "escaped" commands. shiftwidth sw Default: sw=8 Type: numeric This is the number of spaces that a <^T> or <^D> will move over for indenting, and the amount < and > shift by. showmatch sm Default: nosm Type: toggle When a )) or }} is typed, show the matching (( or {{ by moving the cursor to it for one second if it is on the current screen. slowopen slow Default: terminal dependent Type: toggle On terminals that are slow and unintelligent, this option prevents the updating of the screen some of the time to improve speed. tabstop ts Default: ts=8 Type: numeric s are expanded to boundaries that are multi- ples of this value. taglength tl Default: tl=0 Type: numeric If nonzero, tag names are only significant to this many characters. term Default: (from environment TTEERRMM, else dumb) Type: string This is the terminal and controls the visual dis- plays. It cannot be changed when in "visual" mode, you have to Q to command mode, type a set term command, and do ``vi.'' to get back into visual. Or exit vi, fix $TERM, and reenter. The definitions that drive a particular terminal type are found in the file //eettcc//tteerrmmccaapp. terse Default: terse Type: toggle When set, the error diagnostics are short. warn Default: warn Type: toggle The user is warned if she/he tries to escape to the shell without writing out the current changes. window Default: window={8 at 600 baud or less, 16 at 1200 baud, and screen size - 1 at 2400 baud or more} Type: numeric This is the number of lines in the window when- ever vvii must redraw an entire screen. It is use- ful to make this size smaller if you are on a slow line. w300, w1200, w9600 These set window, but only within the -20- corresponding speed ranges. They are useful in an EXINIT to fine tune window sizes. For exam- ple, set w300=4 w1200=12 causes a 4 lines window at speed up to 600 baud, a 12 line window at 1200 baud, and a full screen (the default) at over 1200 baud. wrapscan ws Default: ws Type: toggle Searches will wrap around the end of the file when is option is set. When it is off, the search will terminate when it reaches the end or the beginning of the file. wrapmargin wm Default: wm=0 Type: numeric VVii will automatically insert a when it finds a natural break point (usually a between words) that occurs within "wm" spaces of the right margin. Therefore with "wm=0" the option is off. Setting it to 10 would mean that any time you are within 10 spaces of the right margin vvii would be looking for a or which it could replace with a . This is convenient for people who forget to look at the screen while they type. (In version 3, wrapmargin behaves more like nroff, in that the boundary specified by the distance from the right edge of the screen is taken as the rightmost edge of the area where a break is allowed, instead of the leftmost edge.) writeany wa Default: nowa Type: toggle VVii normally makes a number of checks before it writes out a file. This prevents the user from inadvertently destroying a file. When the "writeany" option is enabled, vvii no longer makes these checks.