#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.12 */ # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License, Version 1.0 only # (the "License"). You may not use this file except in compliance # with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # ********************************************************************** *** NOTE: All pre-1980 commentary has been removed from this file. *** ********************************************************************** Version SVR3.1 1986 MAJOR STRUCTURAL CHANGES & ENHANCEMENTS: 1. ex/vi modified to use an interim version of getopt(3), so that ex/vi can migrate to standardized command syntax. Syntax changes: ILLEGAL (old) LEGAL -r [optional arg] -L (for listing of recovered files) -r arg (to recover file "arg") +cmd -c cmd - (for silent) -s Both legal and (old) illegal options will be accepted for a period of time; later, the old illegal options will be dropped from ex/vi. 2. It is now possible to recover encrypted files. The file header has been changed to include an encrypted flag. Therefore, if the user types "vi -r file" when "file" is encrypted, the program will automatically check the header flag and prompt the user for the encryption key. The actions are as follows: command line encrypted file actions ------------ -------------- ------- vi -r file YES prompted for key associated with recovered file [editing session not encrypted] vi -r file NO regular recovery [editing session not encrypted] vi -r -x file YES prompted for editing session key [editing session encrypted, editing session key is used to recover file] vi -r -x file NO prompted for editing session key [editing session encrypted] 3. The structure of /usr/preserve has been changed to improve security. The directory /usr/preserve will have read-write-execute permissions for everybody. Recovered files will be saved in a subdirectory in /usr/preserve. The subdirectory name is the same as the user's id, owned by the user, and has read-write-execute permissions for the user only. The recovered file in the subdirectory has read-write permissions for the user only. Expreserve, exrecover, and /usr/preserve all have owner and group of "bin"; setuid bits in expreserve and exrecover have been turned off. 4. the command "vi -r" or "vi -L" used to list recoverable files, now lists the user's files found in /tmp as well as /usr/preserve/user so the user has a complete list. Files are listed under the appropriate directory names. 5. name of source directory "vax" changed to "port" 6. exit code of ex/vi reflects number of error/warning messages incurred 7. ctags (used in conjunction with -t option and ":ta") now installed in /usr/bin/ctags (manual page in Section 1). 8. added ed-like enhancement such that "s/text/%" will replace "text" with the righthand side of the previous substitute command. 9. added argument to case operator "~" so that multiple substitutions per line can occur (e.g. "10~"). BUG FIXES: 1.*if input being read by source'd file and an error is encountered, the user is bumped up to the previous source level, instead of being thrown back into command mode. 2.*ex/vi restores tty state if fork fails. 3.*ex/vi allows backspacing and retyping of conditional responses (in the case of ":s/old/new/c"). 4.*"U" (undo line changes) no longer marks file as modified when no editing has been done. 5.*file not automatically considered modified when "vi +cmd file" syntax used. 6.*actions of "ZZ" altered as follows: COMMAND OLD ACTIONS NEW ACTIONS ------- ----------- ----------- vi newfn; ZZ no file created same as old action vi oldfn; ZZ oldfn unchanged same as old action vi newfn; 1,$d; ZZ no file created write empty file vi newfn; a text (0 char; 0 bytes) 1,$d; ZZ no file created write empty file vi oldfn; 1,$d; ZZ oldfn unchanged write empty file vi oldfn; a text; 1,$d; ZZ oldfn unchanged write empty file vi oldfn; dd all; ZZ write empty file same as old action@ 7.*cursor now moves to column 1 when HOME arrow key pushed in INSERT mode. 8.*if showmode set, it will display APPEND/INSERT/REPLACE(etc.) mode as appropriate. 9.*"novice" option can now be set or unset properly. 10.*yank-put now works when wrapmargin set and user tries to do a put at the end of a line (i.e., overlapping the wrap margin). Similar problem also fixed for ":R" for replacements beyond 80 columns or overlapping wrap margins (whichever comes first). 11.*stop "!" from being expanded within the shell escaped command line. Now ":!!" or any "!!" (after the initial shell escape) will cause substitution of the last command. 12.*code fixed to allow hardtabs set to 0. Now, if hardtabs set to 0 (i.e., terminal does not support hardtabs), ex/vi will use spaces to emulate tabbing. 13.*marks no longer lost after undo 14.*Note that the REPORT variable is 5 by default. For informatory messages when changes have been make for fewer than 5 lines, the user should ":set report=x" where x is a number. 15.*"/" no longer considered a command (for undo purposes) 16.*read done by ":Nr file" command (where N is a line number) now correctly undone (by "undo" command) 17.*added boundary checks so that exceeding maximum permitted map statements does not generate core dump/infinite loops 18.*terminal-dependent mapping removed when the user redefines the terminal by "set term=xxx" from ex editor (i.e., so only one terminal is mapped). 19.*'w' (advance a word) no longer fails on lines with trailing spaces. 20.*newline character not added to empty file. 21.*showmode indicator remains on when arrow keys used (e.g., while in input mode, INPUT MODE indicator is on until the ESC key is pressed). 22.*an interrupt during a write operation will no longer cause truncated file with no backup (happened only if file had NOT been modified during edit session; otherwise, backup was automatically initiated). 23.*new set option "modelines" (abbreviated "ml") created to prevent accidental interpretation of code by modelines (i.e., any characters following "ex:" or "vi:" and ending with a ":" would be interpreted as an ex command that would be executed before the file is loaded into the editor). Default of modelines is OFF. 24.*"ei:" and "vx:" no longer considered valid triggers to modelines 25.*abbreviations fixed so they do not loop recursively (i.e., ab yes yes!, or ab O O'Connal). 26.*J, 1J and 2J perform same operation: joining the current line and the next line together. 0J is actually two commands: 0 (meaning go to the beginning of the line) and J (join). 27.*when tmp file becomes too big, line of garbage no longer added to file. 28.*":n +command" no longer infinite loops on 3b2's. 29.*%-matching is now interruptible. 30.*version information put into /usr/lib/exstrings file. Version 3.9 February 10, 1983 A new option "showmode" (smd) causes input mode to be indicated toward the right end of the message line. This is useful for learning vi and for people who get confused about what mode they are in. Only the first letter of the message is shown if "terse" is also set. A new invocation "vedit" is for novices. This is like edit but puts you into visual mode right away. It also sets showmode. The default number of lines to scroll in visual mode on a control D is now the variable scroll, not half the variable window. A bug causing extra CPU usage when vi is reentered after ^Z has been fixed. This also fixes a bug causing a hang until the user types something if you are past column 80 before ^Z. Version 3.8 April 22, 1982 The main change is conversion from termcap to terminfo. More function keys are supported now. Most function keys with a meaning to vi work both in command mode and input mode. A bug in the encryption command causing plain text in the temp file and encrypted text on your screen has been fixed. A new command "crypt" or "X" enters encryption mode once you have started editing, like the ed "x" command. A new command line option "-V" (verbose) is useful for debugging ex scripts. A new boolean set option "flash" allows you to control whether vi uses the visible bell in your terminal (if it has one). The default is "flash", do "set noflash" if the flashing is annoying. The "open" boolean option has been deleted. Ex will no longer prevent the user from entering open mode. This clears up problems with paths and invocations containing the letter "d". If the local system has the Cornell "Fast Timer" driver, vi uses it instead of alarm to detect function keys. This means that the delay after typing escape will usually only be 0.1 second instead of a full second. Of course, if the user continues typing, there is no delay at all. Version 3.7 October 16, 1981 It is now possible to split lines with substitute commands from vi, by using ^V in the rhs. This takes care of the last good reason for using ex command mode. Mode lines are now supported. Put a line containing ex: xxx : in the first or last 5 lines of the file, where xxx is any ex command you want executed when that file is read in. To make other programs happy, it should probably be inside a comment. You can use vi: as well as ex:. (Note: no space allowed between the "ex" and ":". The spaces around xxx are considered part of the command, and so are optional.) If there is a file .exrc in the current directory, it will be sourced when you enter vi, after your EXINIT or ~/.exrc. The changeable scrolling region of the vt100 is now used in place of insert line, resulting in much better performance. Vi uses the new AL, DL, LE, RI, DO, and UP (all upper case) termcap capabilities, which are parameterized versions of their lower case equivalents. This will results in better performance on ANSI terminals, and especially on the Tektronix 4025 which has parameterized local motions but cannot cursor address. Vi uses backtabs again. Now it knows how to handle backtabs on terminals that have tabs set at intervals other than 8, and it won't use backtabs if gtty indicates it can't use tabs. A bug causing to core dump vi has been fixed. A bug causing writes to filters when editing encrypted files to write encrypted text has been fixed. A bug causing the message "substitution loop", when you enter a 1,$s/xxx/yyy/g with lots of changes, has been fixed. A bug causing the current directory to be chmod'ed to 0 if you set nomesg after starting up the editor has been fixed. Note that the nomesg option is intended for your EXINIT, since it only takes effect on entry to the editor. The eat newline glitch has been fixed so that vt100's and tab132's handle long lines correctly. Some internal changes have been made so that vi can run under UNIX on the Bell Labs 3B machine, the BBN C/70, and the IBM 370. Version 3.6 October 30, 1980 A kernel problem on the V7 pdp-11 overlay systems which causes bad EMT traps to happen randomly, core dumping the editor, has been programmed around by catching EMT traps. A bug which prevented using a screen larger than 48 lines has been fixed. A bug which allowed you to set window to a value larger than your screen size has been fixed. The screen size limit on non-VM/Unix systems has been increased to 66 lines or 5000 characters, to allow the Ann Arbor Ambassador terminal to be used. A bug which caused hangups to be ignored on USG systems has been fixed. A bug which caused maps with multiple changes on multiple lines to mess up has been fixed. If you get I/O errors, the file is considered "not edited" so that you don't accidentally clobber the good file with a munged up buffer. An inefficiency in 3.5 which caused the editor to always call ttyname has been fixed. A bug which prevented the "source" command from working in an EXINIT or from visual has been fixed. A bug which caused readonly to be cleared when reading from a writable file with "r" has been fixed. The name "suspend" has been made an alias for "stop". The stop command now once again works correctly from command mode. On a dumb terminal at 1200 baud, "slowopen" is now the default. A bug in the shell script "makeoptions" which searched for a string that appeared earlier in a comment has been fixed. A bug that caused an infinite loop when you did ":s/\" at the wrapmargin column to mess up has been fixed. On terminals with both scroll reverse and insert line, the least expensive of the two will be used to scroll up. This is usually scroll reverse, which is much less annoying than insert line on terminals such as the mime I and mime 2a. A bug which caused vi to estimate the cost of cursor motion without taking into account padding has been fixed. The failure of the editor to check counts on ^F and ^B commands has been fixed. The "remap" option failed completely if it was turned off. This has been fixed. A check of the wrong limit on a buffer for the right hand side of substitutions has been fixed. Overflowing this buffer could produce a core dump. A bug causing the editor to go into insert mode if you typed return during an R command has been fixed. A bug preventing the + command from working when you edit a new file has been fixed by making it no longer an error to edit a new file (when you first enter the editor.) Instead you are told it is a new file. If an error happens when you are writing out a file, such as an interrupt, you are warned that the file is incomplete. Version 3.5 -- August 20, 1980 The provisions for changing the window size with a numeric prefix argument to certain visual commands have been deleted. The correct way to change the window size is to use the z command, for example z5 to change the window to 5 lines. The code to handle the -x (encryption) option has been made conditionally compiled, so that ex can run on an an 11/34 (!) with overlays. Since this code calls getpass, stdio was being pulled in even without VMUNIX being defined. The savings from not defining CRYPT are about 4K of text and 4.5K of bss. Bill Joy put in a buffering scheme under the VMUNIX flag so that up to 64K of file is edited in-core until you make enough changes to force a temp file sync. This makes entry into the editor much faster, but also makes vi much bigger. The source to ex is now sccs'ed. An undocumented "feature" which caused the ^^ command to return to the previous tag, if in the current file, instead of the previous file, has been removed. A bug which prevented ex from compiling on systems with the new tty driver but no process control (such as Cory) was fixed. Version 3.4 -- June 24, 1980 The visual page motion commands ^F and ^B now treat any preceding counts as number of pages to move, instead of changes to the window size. That is, 2^F moves forward 2 pages. A :vi command from visual mode is now treated the same as a :edit or :ex command. The meaning of the vi command from ex command mode is not affected. Provisions to handle the new process stopping features of the Berkeley TTY driver have been added. A new command, "stop", takes you out of the editor cleanly and efficiently, returning you to the shell. Resuming the editor puts you back in command or visual mode, as appropriate. If autowrite is set and there are outstanding changes, a write is done first unless you say "stop!". From visual mode, the command ^Z is the same as :stop. Note that if you have an arrow key that sends ^Z the stop function will take priority over the arrow function. If you have your "susp" character set to something besides ^Z, that key will be honored as well. A read only mode now lets you guarantee you won't clobber your file by accident. You can set the on/off option "readonly" (ro) and writes will fail unless you use an ! after the write. Commands such as x, ZZ, and autowrite, and in general anything that writes is affected. This option is turned on if you invoke ex with the -R flag. A new link called "view" has been created. View is just like vi but it sets readonly. The encryption code from the v7 editor is now part of ex. You invoke ex with the -x option and it will ask for a key, as ed. The ed "x" command (to enter encryption mode from within the editor) is not available. The editor now adopts the convention that a null string in the environment is the same as not being set. This applies to TERM, TERMCAP, and EXINIT. A word abbreviation mode is now available. You can define abbreviations with the abbreviate command :abbr foo find outer otter which maps "foo" to "find outer otter". Abbreviations can be turned off with the "unabbreviate" command. The syntax of these commands is identical to the map and unmap commands, except that the ! forms do not exist. Abbreviations are considered when in visual input mode only, and only affect whole words typed in, using the conservative definition. (Thus "foobar" will not be mapped as it would using map!) Abbreviate and unabbreviate can be abbreviated to "ab" and "una", respectively. The editor now supports certain terminals that use strings other then \r and \n for return and linefeed by implementing the cr and nl termcap options. (Thanks to UCLA for these enhancements). The termcap attribute ns is now checked for, and ex refuses to go into visual mode on such a terminal unless it has sf. Terminals that can cursor address but cannot go up a line now work in visual. If you change your start and stop characters to something other than the default ^S and ^Q, vi now turns them off. This causes people who change them to escape not to lose so badly. The quit character is once again turned off so that datamedias which send ^\ for the right arrow key work. The ~ command now repeats correctly with ".". If you type in an unmatched ) or } in showmatch mode, the editor will now beep to warn you about your mistake. The ) or } is still accepted. The way macros are undone has been improved considerably. The number of changes inside the macro is counted, and just before the second change the state before the macro is recreated internally and saved to allow the macro to be undoable as a unit. Hence, if the macro makes only one change the particular change is undone (which will probably not redraw the screen). If no changes are made (for example, the arrow keys) the previous thing that could be undone is not clobbered. The undomacro option has been deleted since it is no longer needed. Editor scripts can now contain comments. Begin the comments with " (double quote). Comments can be on their own line or come at the end of command lines. The comment continues to the end of the line. The 3rd version of the USG tty driver is now supported, making it possible on USG systems to interrupt redrawing the screen and to not flush output when interruptible commands take place. The rewind command has been added to the list of commands that the autowrite option knows about. The wrapmargin option is now usable. The way it works has been completely revamped. Now if you go past the margin (even in the middle of a word) the entire word is erased and rewritten on the next line. This changes the semantics of the number given to wrapmargin. 0 still means off. Any other number is still a distance from the right edge of the screen, but this location is now the right edge of the area where wraps can take place, instead of the left edge. Wrapmargin now behaves much like fill/nojustify mode in nroff. A bug on the USG system where hanging up the phone causes more than one SIGHUP to be sent has been compensated for. A bug which caused the :sh command not to send the vs and ti sequences when you returned has been fixed. A bug which caused a file that bombed out in the middle of an edit command to be considered modified has been fixed. A bug which caused the screen to be wrong after undoing a :move command has been fixed. A bug which messed up the buffer and the screen after undoing a :join command has been fixed. The source file ex_io.c has been split into ex_io.c and ex_unix.c to avoid a problem where many C compilers overflowed the symbol table. A bug which prevented turning off your prompt in your .exrc has been fixed. Some of the code internal to the editor has been rearranged and some comments added. The bug fix to the USG tty driver to output a null character as padding at 1200 baud has been improved to output a DEL at 1200 baud or above. Terminals with small screens (less than 20 columns or less than 5 lines) should now work. A bug which prevented you from entering the character DEL into the buffer if you changed your interrupt character to something else besides DEL has been fixed. A bug which caused the current line to be clobbered when you did a /, ?, or : command which mapped an input macro successfully has been fixed. If you map o to O and O to o and have remap set, the editor now catches the infinite loop. A put command after a macro now beeps instead of putting a copy of the whole buffer. (Note that the arrow keys on terminals are considered macros.) A bug which caused things like d) and d} to miss the last character when they should have deleted to the end of the buffer has been fixed. A bug which caused the last character to be lost when you read in a file with no newline at the end of the last line has been fixed. A bug that caused garbage to be in the buffer if the temp file overflowed has been fixed. (This only affected non-VMUNIX systems since the temp file cannot overflow on VMUNIX.) When a macro or global is undone, you no longer get picked up and dropped on line 1. The character | can now be escaped with \| in file names. A bug which prevented the confirm option to a substitution that was inside a source command has been fixed. A bug which caused the editor to not work if the tab stop size did not divide the screen width has been fixed. A bug on HP terminals that caused the screen to be messed up if you scrolled up something that began the same way as the echo line has been fixed. A macro bug which sometimes caused the next character after an escape to be ignored on an HP terminal has been fixed. A bug which caused unmap of strings with length 2 to fail has been fixed. A bug which left vi confused if you invoked a macro containing a quit to command mode and then did an undo has been fixed. An old ed bug which caused globals to fail when they did a substitute on the next line has been fixed. The % operator will now find matching square brackets the same way it does parentheses and braces. It will not display them in showmatch mode, however, and will not use a ] to match all ('s. Code has been added to handle the Beehive Superbee terminal, using f1 for escape and f2 for control C. The default value of the option shell is now taken from the environment variable SHELL, if present. Version 3.3 -- February 2, 1980 The default window sizes have been changed. At 300 baud the window is now 8 lines (was 1/2 the screen size). At 1200 baud the window is now 16 lines (was 2/3 the screen size, which was usually also 16 for a typical 24 line CRT). At 9600 baud the window is still the full screen size. Any baud rate less than 1200 behaves like 300, any over 1200 like 9600. A new command mode command "x" (for "xit") has been added. This is the same as wq but will not bother to write if there have been no changes to the file. The command letter was chosen for convenience and compatibility with hed. The command "ZZ" from vi is the same as ":x". This is the recommended way to leave the editor. Z must be typed twice since this is two easy to type by accident and has such severe effects if unintentional. The options w300, w1200, and w9600 can be set. They are synonyms for "window", but only apply at 300, 1200, or 9600 baud, resp. Thus you can specify you want a 12 line window at 300 baud and a 23 line window at 1200 baud with :set w300=12 w1200=23 It is now possible to say :set window=5 and get the effect the next time the screen is redrawn from scratch. (^L and Hit return to continue don't start from scratch.) This is sort of pointless, since both 5: and z5 do the same thing with better results. The editor no longer uses nondestructive space, except when in insert mode. It instead prints the character it would be moving over. This is a real win on terminals that use an escape sequence to nd space. It is now possible from visual to string several search expressions together separated by semicolons the same as command mode. For example, you can say /foo/;/bar from visual and it will move to the first "bar" after the next "foo". This also works within one line. The option "mapinput" is dead. It has been replaced by a much more powerful mechanism: :map! (e.g. put an ! after the map). Map and unmap commands with ! apply only to input, others apply only to command mode. The new option "timeout" (default on) causes macros to time out after one second. Turn it off and they will wait forever. By using map! and setting notimeout, it is possible to get the effect of emacs abbreviation mode. Sanity checking is turned off for map when ! is present. This is a crude facility and does not take into account things like the abbreviation being part of a longer word. It also does not echo until it is satisfied. The new option "remap" (default on) causes the editor to attempt to map the result of a macro mapping again until the mapping fails. This makes it possible, say, to map q to # and #1 to something else and get q1 mapped to something else. Turning it off makes it possible to map ^L to l and map ^R to ^L without having ^R map to l. The new option "undomacro" (default on) makes it possible to undo macros as a unit. Leaving it off causes macros not to be treated specially. Macros with zero or one change work better with noum, with two or more changes better with um. This option may go away if it becomes unnecessary. The new (string) valued option "tags" allows you to specify a list of tag files, similar to the "path" variable of csh. The files are separated by spaces (which are entered preceded by a backslash) and are searched left to right. The default value is "tags /usr/lib/tags", which has the same effect as before. It is recommended that "tags" always be the first entry. On Ernie, /usr/lib/tags contains entries for the system defined library procedures from section 3 of the manual. ^R is now the same as ^L on terminals where the right arrow key sends ^L (The tvi and the adm 31). Looking for a tag now uses binary search. The "q" command from visual no longer works at all. You must use "Q" to get to ex command mode. A minor incompatibility with the v7 ed has been fixed. Previously, to do a global substitute with an escaped newline in the rhs, you had to put two \'s in ex and one in ed. Ex now accepts the single form as well as the double form. For example, instead of g/foo/s//foo\\ bar/g (which still works), you can now type, as in ed, g/foo/s//foo\ bar/g This means that the following ex command, which used to "work": g/foo/s//foo bar\ .+1,/mumble/d won't work anymore unless you put the trailing / on the substitution. This usage is pretty obscure anyway. Several bugs relating to undoing macros have been fixed. A bug which caused the command "g/pattern" to print an error message if "pattern" occurred on the last line has been fixed. If you reply ":" to "Hit return to continue", you will again be asked "Hit return to continue" after the next command finishes. The maximum length of a string valued option has been raised from 32 to 64, for the benefit of the "tags" option. It is now possible to search for an escape or delete using f, F, t, T, ;, and ,. These characters must be quoted with ^V. The option "ttytype" is now in correct alphabetical order. A bug that caused HP terminals to mess up in insert mode when inserting before a tab which follows 7 or fewer characters at the beginning of a line (such as a tags file) has been fixed. It is now possible to include control D in your EXINIT or .exrc. A bug which caused the screen to mess up when a glob (such as xx*) doesn't match anything has been fixed. The editor now checks for extra junk after a /r.e./ from visual (other than the allowed z command) and beeps if any is found. Previously it was just ignored. A bug that caused j and k (up and down) to behave strangely after an insertion has been fixed. A bug which causes term to be displayed incorrectly and which caused a crash when changing terminal type when there happened to be several |'s and a long string in genbuf has been fixed. This bug was introduced in ex 2.9. The patch for echo lines longer than 80 characters has been repaired to do "Hit return to continue" after such lines and print the entire output. A bug that caused a messed up screen after a :sh command from open mode has been fixed. A bug which caused a tag request for a nonexistent tag to leave the editor in nomagic mode has been fixed. A bug which caused strange behavior if there is no default file name when an autowrite save is attempted has been fixed. A bug which caused the cursor to go to the wrong position when ^^D or 0^D is entered from column 2 in autoindent mode on terminals that can backspace has been fixed. Version 3.2 -- January 4, 1980 A bug that caused nomagic to be set if an error happened within a tag command has been fixed. A bug that caused put commands to beep after a macro containing an error has been fixed. The mapinput option has been placed in alphabetical order. A bug that caused undo to undo more than one macro invocation on the same line has been fixed. On non VM/UNIX systems, the screen size has been increased to allow a 40 X 80 Ann Arbor to be used. Version 3.2 -- December 28, 1980 Several limits have been increased for VM/UNIX. Longer lines, more characters of file names, longer regular expressions, etc. Huge files can now be edited directly. Larger terminals (up to 66 lines) can be used. An internal change has been made for VM/UNIX that causes error messages to be stored directly instead of in a disk file. This should cause faster response to errors. Version 3.1.1 -- December 13, 1979 A bug that caused nested macros not to be undoable has been fixed. A bug that caused pounding on the escape key on terminals with arrow keys that send escape sequences to cause undo to mess up has been fixed. It is now acknowledged that macros cannot contain the put command. This is due to the implementation of put - previously a put inside a macro dumped a copy of the buffer instead of the desired text and left the editor in a very strange state. Now such a put just beeps. Version 3.1 -- November 1, 1979 Versions from 3.1 up are too large to fit on pdp-11's. (Special overlay software is expected to be available soon for v7 pdp-11 Unix that will make it fit.) Version 2.9 is 3.1 with only the bug fixes and very few of the enhancements. 2.9 will fit on a pdp-11. Version 2.10 will come out and may correspond to 3.2. (It turned out to correspond to 3.3) For compatibility with ed: 's' may be used as a command and means '&'. If you set the option "edcompatible" (abbr "ed") the presence or absence of g and c suffices is remembered and can be toggled by repeating the suffices. The suffix "r" makes the substitution into "~" instead of "&". A new command line option -w sets the value of window before starting ex. Hence: 'vi -w5 file' makes a quick change to a file easier at 300 baud. Arrow keys on terminals that send more than 1 character now work. Home up keys are supported as are the four directions. Ex no longer looks at the ma= entry in termcap, but uses the ku, kd, kl, kr, and kh entries. (Note that the HP 2621 will turn on function key labels, and even then you have to hold shift down. To avoid turning on the labels, and to give up the function keys, use terminal type 2621nl instead of 2621.) A parameterless macro facility is included from visual. Briefly, there are two flavors of macros: a) Put the macro body in a buffer register, say x. Then type @x to invoke it. @ may be followed by another @ to repeat the last macro. This allows macros up to 512 chars. b) Use the map command from command mode (typically in the .exrc file) as follows: map lhs rhs where lhs will be mapped to rhs. There are restrictions: lhs's should be 1-keystroke (either 1 char or 1 function key) since they must be entered within 1 second. lhs no longer than 10 chars, rhs no longer than 100. To get " ", "\t", "|", or "\n" into lhs or rhs, escape them with ctrl V. (It may be necessary to escape the ctrl V with ctrl V if the map command is given from visual mode.) For 1 shot macros it is best to put the macro in a buffer register and map a key to '@r', since this will allow the macro to be edited. Macros can be deleted with unmap lhs The boolean option "mapinput" (mi) will, if on, cause macros to be mapped in input mode as well as command mode (in visual only). For example, you can define ctrl T to be four spaces with :map ^V^T_^V^V____ :set mi where underlines represent spaces and the ctrl V's are necessary to get ctrl chars and spaces past various levels, and make ^T be a software tab that even works in the middle of a line. If the lhs of a macro is "#0" through "#9", this maps the particular function key instead of the 2 char # sequence, if the terminal has function keys. This only works if termcap has function key entries for the particular terminal. For terminals without function keys, the sequence #x means function key x, as typed. As a special case, on terminals without function keys, the #x sequence need not be typed within one second. The character # can be changed by using a macro in the usual way: map ^V^I # to use tab, for example. (This won't affect the map command, which still uses #, but just the invocation from visual mode.) The undo command will undo an entire macro call as a unit. New commands in visual: ^Y and ^E. These glitch the screen up and down 1 line, respectively. They can be given counts, controlling the number of lines the screen is glitched. They differ from ^U and ^D in that the cursor stays over the same line in the buffer it was over before rather than staying in the same place on the screen. (^Y on a dumb terminal with a full screen will redraw the screen moving the cursor up a few lines.) If you're looking for mnemonic value in the names, try this: Y is right next to U and E is right next to D. More new commands in visual: '&' is a synonym for ':&'. '~' changes the case of the letter under the cursor and moves to the next character. Ex looks in your environment for EXINIT. If it finds it, that is used instead of looking for your .exrc. This should make entry into ex faster, along with the termlib feature of looking for a termcap entry in TERMCAP. Version 2.13 -- September 23, 1980 The provisions for changing the window size with a numeric prefix argument to certain visual commands have been deleted. The correct way to change the window size is to use the z command, for example z5 to change the window to 5 lines. An undocumented "feature" which caused the ^^ command to return to the previous tag, if in the current file, instead of the previous file, has been removed. Version 2.12 -- July 23, 1980 A change was made to the sys_errlist array in ex_subr.c so that Berkeley V7 quotas will produce the right error message. A couple of minor bug fixes were made to get the editor to compile on version 6. The option to use 1K BUFSIZ has been deleted, since it is no longer used on our 1K system. Version 2.11 -- June 24, 1980 The visual page motion commands ^F and ^B now treat any preceding counts as number of pages to move, instead of changes to the window size. That is, 2^F moves forward 2 pages. A :vi command from visual mode is now treated the same as a :edit or :ex command. The meaning of the vi command from ex command mode is not affected. A read only mode now lets you guarantee you won't clobber your file by accident. You can set the on/off option "readonly" (ro) and writes will fail unless you use an ! after the write. Commands such as x, ZZ, and autowrite, and in general anything that writes is affected. This option is turned on if you invoke ex with the -R flag. A new link called "view" has been created. View is just like vi but it sets readonly. The editor now supports certain terminals that use strings other then \r and \n for return and linefeed by implementing the cr and nl termcap options. (Thanks to UCLA for these enhancements). The termcap attribute ns is now checked for, and ex refuses to go into visual mode on such a terminal unless it has sf. If you change your start and stop characters to something other than the default ^S and ^Q, vi now turns them off. This causes people who change them to escape not to lose so badly. The quit character is once again turned off so that datamedias which send ^\ for the right arrow key work. If you type in an unmatched ) or } in showmatch mode, the editor will now beep to warn you about your mistake. The ) or } is still accepted. Editor scripts can now contain comments. Begin the comments with " (double quote). Comments can be on their own line or come at the end of command lines. The comment continues to the end of the line. The 3rd version of the USG tty driver is now supported, making it possible on USG systems to interrupt redrawing the screen and to not flush output when interruptable commands take place. The rewind command has been added to the list of commands that the autowrite option knows about. A bug on the USG system where hanging up the phone causes more than one SIGHUP to be sent has been compensated for. A bug which caused a file that bombed out in the middle of an edit command to be considered modified has been fixed. The source file ex_io.c has been split into ex_io.c and ex_unix.c to avoid a problem where many C compilers overflowed the symbol table. A bug which prevented turning off your prompt in your .exrc has been fixed. Some of the code internal to the editor has been rearranged and some comments added. The bug fix to the USG tty driver to output a null character as padding at 1200 baud has been improved to output a DEL at 1200 baud or above. Terminals with small screens (less than 20 columns or less than 5 lines) should now work. A bug which prevented you from entering the character DEL into the buffer if you changed your interrupt character to something else besides DEL has been fixed. A bug which caused things like d) and d} to miss the last character when they should have deleted to the end of the buffer has been fixed. A bug which caused the last character to be lost when you read in a file with no newline at the end of the last line has been fixed. A bug that caused garbage to be in the buffer if the temp file overflowed has been fixed. The character | can now be escaped with \| in file names. A bug which caused the editor to not work if the tab stop size did not divide the screen width has been fixed. A bug on HP terminals that caused the screen to be messed up if you scrolled up something that began the same way as the echo line has been fixed. An old ed bug which caused globals to fail when they did a substitute on the next line has been fixed. The % operator will now find matching square brackets the same way it does parentheses and braces. It will not display them in showmatch mode, however, and will not use a ] to match all ('s. Ex looks in your environment for EXINIT. If it finds it, that is used instead of looking for your .exrc. This should make entry into ex faster, along with the termlib feature of looking for a termcap entry in TERMCAP. Internally, it is possible to turn off about a dozen different options when compiling the editor to make it fit in 64K. See the makefile for a list of options. Version 2.10 -- February 2, 1980 (Corresponds to 3.3) The default window sizes have been changed. At 300 baud the window is now 8 lines (was 1/2 the screen size). At 1200 baud the window is now 16 lines (was 2/3 the screen size, which was usually also 16 for a typical 24 line CRT). At 9600 baud the window is still the full screen size. Any baud rate less than 1200 behaves like 300, any over 1200 like 9600. A new command mode command "x" (for "xit") has been added. This is the same as wq but will not bother to write if there have been no changes to the file. The command letter was chosen for convenience and compatibility with hed. The command "ZZ" from vi is the same as ":x". This is the recommended way to leave the editor. Z must be typed twice since this is two easy to type by accident and has such severe effects if unintentional. The options w300, w1200, and w9600 can be set. They are synonyms for "window", but only apply at 300, 1200, or 9600 baud, resp. Thus you can specify you want a 12 line window at 300 baud and a 23 line window at 1200 baud with :set w300=12 w1200=23 The "q" command from visual no longer works at all. You must use "Q" to get to ex command mode. The editor no longer uses nondestructive space, except when in insert mode. It instead prints the character it would be moving over. This is a real win on terminals that use an escape sequence to nd space. A minor incompatibility with the v7 ed has been fixed. Previously, to do a global substitute with an escaped newline in the rhs, you had to put two \'s in ex and one in ed. Ex now accepts the single form as well as the double form. For example, instead of g/foo/s//foo\\ bar/g (which still works), you can now type, as in ed, g/foo/s//foo\ bar/g This means that the following ex command, which used to "work": g/foo/s//foo bar\ .+1,/mumble/d won't work anymore unless you put the trailing / on the substitution. This usage is pretty obscure anyway. A bug which caused the command "g/pattern" to print an error message if "pattern" occurred on the last line has been fixed. Limits have been raised so that an Ann Arbor terminal can be used, and long tags can now be accommodated. A bug that caused HP terminals to mess up in insert mode when inserting before a tab which follows 7 or fewer characters at the beginning of a line (such as a tags file) has been fixed. A bug which causes term to be displayed incorrectly and which caused a crash when changing terminal type when there happened to be several |'s and a long string in genbuf has been fixed. This bug was introduced in ex 2.9. The patch for echo lines longer than 80 characters has been repaired to do "Hit return to continue" after such lines and print the entire output. A bug that caused a messed up screen after a :sh command from open mode has been fixed. A bug which caused a tag request for a nonexistent tag to leave the editor in nomagic mode has been fixed. A bug which caused strange behavior if there is no default file name when an autowrite save is attempted has been fixed. A bug which caused the cursor to go to the wrong position when ^^D or 0^D is entered from column 2 in autoindent mode on terminals that can backspace has been fixed. In order to get 2.10 to fit on a v7 pdp-11, the following features have been deleted: The MASTERTAGS feature (undocumented use of /usr/lib/tags as an alternate tag file) Checking that a file being read in is an ascii file. Turning off ^Q/^S on a v7 system.