previous next top contents index framed top this page unframed
MAINVI is not case-sensitive with respect to line-oriented command or variable names (case is distinguished in single-character commands, of course). Command and variable names may be abbreviated to their shortest unique prefix.
3.1. Commands
3.1.1. g: Moving to a Page Mark
Since the MAINSAIL compiler and other tools often refer to file
positions in terms of pages, it is convenient to have a command that
moves based on pages. The g command, with an argument, goes to
the start of the page specified;
with no argument, it moves to the start of the next page.
The g command may be used as an object of the usual operators;
e.g., d3g deletes to the start of page 3.
For example, to switch to a buffer containing a file foo.msl:
:buffer foo.msl<eol>
or, if FOO.MSL is the only the buffer name containing the substring FOO:
:buffer foo<eol>
The buffer named CMDLOG is used for most program interaction.
A buffer need not have a file associated with it. When the :buffer command creates a new buffer, no file is associated with the buffer, by default. To create a buffer containing a file, use the :edit command, as in vi.
More than one buffer may be created into the same data. Since several buffers may be displayed on the screen simultaneously, this allows multiple windows into the same file. To create a buffer BAR with the same data as a buffer FOO, end the buffer name with a comma:
:buffer bar,<eol>
The editor then prompts for a front end (answer vi) and a back
end;
answer the latter question with =foo, meaning the same data as
in the buffer FOO.
Consult the MAINED User's Guide for more information.
3.1.3. :swm, :frontend
The :swm {commands} command
changes the command and view front ends for the
current buffer to MAINED.
If commands is present, the
change is effective only as long as it takes
to execute the commands,
and then the front ends revert to MAINVI.
If commands is absent, the change is permanent.
The :frontend s command
changes the front end of the current buffer
and all existing buffers to s.
s also becomes the default front end for newly created buffers
in the current editing session.
3.1.4. :hredo, :hundo
The :hundo command provides a more extensive facility for undoing
commands than vi
(the H comes from the fact that :hundo works the same way as
the MAINEDIT H command).
It accepts a numeric argument, the number of changes to be undone.
:hundo is not its own inverse;
subsequent :hundos undo progressively more changes until the limit
of saved changes (currently 500) is reached.
:hredo redoes undone changes; it is the inverse of :hundo. Like :hundo, it accepts a numeric argument telling how many undone changes to redo.
For example:
:hundo 10<eol>
undoes the last ten changes.
All the undo commands, including u
and U, have the same granularity
as MAINED's undo command.
In some cases, this means they undo a
different amount of work from real vi's.
3.1.5. :invoke
“:invoke moduleName arguments”
invokes a MAINSAIL module moduleName and
passing the arguments arguments to it.
:invoke with no argument
returns control to the currently executing
module, if any (module executions are stacked; only the one on top
of the stack is active at any given time).
Interaction with line-oriented programs (e.g., the MAINSAIL compiler) appears in the buffer CMDLOG. An end-of-line in input mode in CMDLOG causes the last line typed (minus prompt, if any) to be sent to the currently executing program. More details on the use of CMDLOG may be found in Chapter 17 of the MAINED User's Guide.
Some programs, e.g., MAINDEBUG, have a special display interface.
Consult the user's guide for the program you are interested in for
details.
MAINDEBUG's interaction with the text editor is independent of
the front end used; it can be used with either MAINEDIT or MAINVI.
3.1.6. :leftcolumn
The :leftcolumn command accepts a numeric argument that specifies
which column of the buffer is to be displayed at the left of the
current window
(column numbers are one-origin).
For example, to scroll the screen left by 20 lines:
:leftcolumn 21<eol>
This command is necessary to see the contents of lines longer than the
width of an editor window, since MAINVI does not wrap lines on
the display.
3.1.7. :lset, :set
:set sets options globally (i.e., for all MAINVI buffers).
:lset is used to set an option for just the current buffer. When option values are displayed, they include the name of the applicable buffer, since the global :set used for inquiry shows values in all MAINVI buffers.
3.1.7.1. :reinit
A new command, :reinit, has been added to reinitialize the
terminal mode and redisplay the screen.
3.1.8. :unabbreviateall, :unmapall
The :unabbreviateall command may
be used to forget all abbreviations
(as set by the :abbreviate command);
the :unmapall command to forget all macros
(as set by the :map and :map! commands).
These are useful if undesired macros have been restored from the
eparms file.
3.1.9. :mapcode, :mapcode!
Arbitrary character codes can be mapped using the :mapcode and
:mapcode! commands, which are like the :map and
:map! commands,
except
that the first word is not the keystroke
itself that is to be mapped but
the decimal character code of
the keystroke to be mapped. In the case
of :mapcode, this is a code
produced by dpycRead; for :mapcode!, by
unmappedDpycRead.
You can use the program of Appendix C of the MAINEDIT User's Guide to determine key codes
produced by a display module;
answer Y to the initial prompt for
mapped (dpycRead) codes or N
or unmapped (unmappedDpycRead) codes.
3.2. Variables
Variables are maintained on a per-buffer basis, except as noted;
changing a variable in one MAINVI buffer does not affect the
value of the variable in any other buffer.
3.2.1. leftBorderChar, rightBorderChar (Numeric)
By default, MAINVI does not display “border” characters
(MAINEDIT, by default, displays columns of colons on each side of
an editor window).
If MAINEDIT-style borders are desired, they may be specified by
giving a non-zero character code as the value of leftBorderChar
or rightBorderChar.
For example, to set both margins to colons on an ASCII system:
:set leftborderchar=58 rightborderchar=58<eol>
(58 is the ASCII code for :).
3.2.2. width (Numeric)
The width variable controls
the displayed width of the current window.
For example:
:set width=20<eol>
causes only the first 20 characters of each line to be displayed.
3.2.3. pageAndLinePrompt
If the option pageAndLinePrompt is set,
MAINED-style initial page and line prompts are given when entering
a new buffer. If not set, these prompts are suppressed.
This also applies to any other front ends (e.g., MAINED) that
may be used in the same editing session.
By default, this option is not set.
3.2.4. replaceWithoutPrompt
If the option replaceWithoutPrompt is set,
the prompt “Replace existing file ...”
is suppressed for all files
(this also applies to any other front ends (e.g., MAINED) that
may be used in the same editing session).
By default, this option is not set.