MAINEDIT User's Guide, Chapter 2

previous   next   top   contents   index   framed top   this page unframed

2. Differences between MAINVI and vi

XIDAK has not been able to determine in advance which deviations from the behavior of vi will prove annoying to regular vi users and which will go unnoticed. The list given here is probably not complete. An attempt has been made to order the list roughly with the most egregious differences first, but only the experience of individual users will determine which differences they find significant.

In many cases, screen update may differ somewhat in MAINVI, especially in ex mode (the mode entered by the Q command) and shell escape commands.

2.1. Initialization

MAINVI examines the UNIX EXINIT shell variable only on UNIX. On all operating systems, it attempts to read the file .exrc in the home directory. It then attempts to read the file .mainvirc on the home directory; this is where initialization commands that are incompatible with real vi should be put. If an eparms file is present, MAINVI also remembers in it the last file edited and all abbreviations and macros from MAINVI sessions (the DONOTUPDATEEPARMS parameter may be used to suppress this remembered information).

2.2. Status Line

MAINVI uses one line of each window for a status line, which includes the line number (preceded by L#), page number (preceded by P.), and page-relative line number (preceded by L.) of the line at the top of the window, a letter representing the current mode (C for command, I for input), and the name of the buffer. This line is required to separate the current window from other windows that may also be on the screen (a feature vi does not provide). Prompts appear on the top line of the screen instead of the bottom.

2.3. Tabs

Tabs are treated very differently in MAINVI and vi. MAINEDIT “expands” tabs to tabified blanks, as described in Section 1.11 of the MAINEDIT User's Guide. It is possible to position the cursor at each position within a tab in a MAINVI buffer, as if the tab were completely expanded to blanks; i.e., the cursor-left and cursor-right commands do not jump to the last position of the tab as in vi. The editor does, however, remember which blanks originated as blank characters and which as tabs, so that when a file is written out, undisturbed tabs are written as tabs.

2.4. Lines Too Long to Fit on the Screen

Lines too long to fit on the screen are wrapped onto subsequent lines by vi. MAINVI displays a tilde in the last column of the overly long line and does not display the characters extending beyond the edge of the screen, so that there is always exactly one line on the screen for each line in the buffer. It is possible to scroll the screen left or right to see these invisible characters by issuing the :leftcolumn command.

2.5. Display of Control Characters

The ^X notation is not used; an asterisk is displayed on most terminals for a non-printing character. The actual contents of a range of lines may be displayed with the :list command. In a non-ASCII character set, :list writes all characters not in the MAINSAIL character set as \nnn, where nnn are octal digits. MAINVI's :print differs from :list in that it does no special processing of control characters.

2.6. Page Marks (CTRL-L in a File)

The page mark character (CTRL-L on ASCII systems) is always preceded by an end-of-line, and is always displayed on the screen so that it takes up a full line. The preceding end-of-line is actually present in the file when it is written; the apparent end-of-line after the page mark line is not present. This is a property of the editor back end required by MAINEDIT, but a nuisance in MAINVI.

The g command may be used to move to the beginning of a page.

On many terminals, you cannot insert a page mark by typing CTRL-L directly. The easiest way to insert a page mark on such terminals in MAINVI is to issue the command :swm p. The :swm command allows MAINED-specific commands to be issued (in this case the P command to insert a page mark).

2.7. Deletions during Input Mode

vi does not immediately erase characters from the screen deleted by the backspace key in input mode, although these characters are erased when input mode is exited. MAINVI erases them each time the backspace key is pressed, so that the screen always reflects the buffer contents.

The c command does not put a dollar sign at the end of text to be deleted, but goes ahead and deletes it before insertion starts.

The characters used for deletions during insert mode are hardwired as CTRL-U (for line deletions), CTRL-W (for word deletions), and backspace or delete (for character deletions). They are not read from the current UNIX terminal mode information.

2.8. CTRL-L Command

CTRL-L is a screen refresh command in vi (a near synonym is CTRL-R). On most terminals, CTRL-L is the MAINEDIT <abort> command, so CTRL-R should be used instead. Use CTRL-R also when you change the size of a terminal emulator window in which MAINVI is running; MAINVI checks the size of the screen each time this command is issued, and adjusts the size of its display accordingly.

The <abort> key is used in some situations where CTRL-C (or the UNIX interrupt character) would be used in vi. The regular interrupt character should be used to abort a shell command invoked from MAINVI.

2.9. Shell Commands

Commands that invoke the shell or another process work only on systems that have MAINSAIL STREAMS installed. Consult the MAINSAIL STREAMS User's Guide for details.

2.10. Delete Buffers and Text Recovery

Deletions always go into the numbered buffer ring (buffers are numbered from 1 to 9); if a lettered buffer is specified, the deletion also goes into it. All deletions are saved except those made in input mode. The default buffer from which text is recovered is 1. Text is recovered in the order deleted, without extra line breaks inserted between character-oriented deletions.

2.11. Macros

Command mode macro left-hand sides are limited to a single keystroke (most keys that send escape sequences are considered a single keystroke). Input mode macros (those defined by :map!) are usually limited to keys that generate a single character code.

2.12. Ignored Modes and Variables

The following :set variables are ignored:

directory hardtabs lisp list open
optimize redraw slowopen taglength
term terse w300 w1200 w9600 writeany

2.13. tabstop

The tabstop variable controls both the amount of space inserted by the <tab> command and the interpretation of tabs from the current file. At present, changing the tabstop variable affects only buffers created after the change, not the current buffer.

2.14. Undoing Commands

Undo (the u command or :undo) undoes the same amount of work as MAINED's H command, which may differ in some situations from vi's undo. Entire macro calls are undone not as a unit, but as individual changes. u is its own inverse, as in vi. A more extensive undo facility is provided by the :hundo and :hredo commands.

2.15. Marks

Marks remember only the page, line, and character number; they do not hold onto the actual text the way vi marks do. The insertion of a page mark character before a mark, or of text before a mark on the same page, will change the mark position with respect to the text.

2.16. Quoting Input Characters

When responding to a prompt, CTRL-V may be used to escape characters that would normally terminate the input of text, and backslash to escape characters that would be treated specially by the command being given. On UNIX, the operating system may also intercept CTRL-V, so two CTRL-Vs may be necessary to get the effect of one CTRL-V.

2.17. Tags

Tags are not supported and the commands dealing with them are not implemented.

2.18. = (Indent for LISP)

The = (indent for LISP) command is not implemented.

2.19. Crash Facilities

Facilities for recovering from crashes (:preserve, :recover) are not implemented. :write should be used frequently to save the state of the current file, if necessary.

2.20. Other Unimplemented Commands

We have not been able to figure out what the :~ command is supposed to do. The documentation we have is no help, and we have been unable to observe useful behavior produced by this command in experiments with vi. Any help on this would be appreciated.

2.21. File Argument List

The initial file argument list does not exist in MAINVI. Commands dealing with this list (e.g., :next) are not implemented. Use the :edit and :buffer commands to edit other files in the same editing session.

2.22. Reading a File

MAINVI reads text from a file on an as-needed basis. The file therefore remains open until the end of the file is read.

2.23. Autoindent Space and CTRL-D in Input Mode

Autoindent space inserted at the beginning of a new line can be backspaced or deleted like normal text; vi requires the use of the CTRL-D command to remove this space. CTRL-D works anywhere on the line in input mode, not just at the beginning.

2.24. Warnings about Switching among Buffers

Warnings are not issued when switching among buffers or writing out files; the editor prompts for whether to write out unwritten files and replace existing files.

2.25. The Bell

vi sometimes ring the bell if a cursor movement command fails, but sometimes not. MAINVI always rings the bell.

2.26. Error Messages

Error messages often differ from vi's (although they should be at least as intelligible). Inverse video is never used in error messages.

2.27. Printing the Current Line in ex Mode

Flags governing printing (p, l, and +) of the current line after a command is executed are ignored; MAINVI prints lines by default more frequently than vi, so the flags are not very useful.
previous   next   top   contents   index   framed top   this page unframed

MAINEDIT User's Guide, Chapter 2