A.VI(1)

NAME
a.vi - vi with extensions for Ada source files

SYNOPSIS
a.vi [ -x ] [ -t tag ] [ -r ] [ +command ] [ -l ] [ -wn ] name ...

DESCRIPTION
A.vi is a modified version of UNIX 4.2bsd vi which facilitates the use of vi on Ada source files. If vi is invoked as a.vi or if the ada option is set, the extensions described here will apply. (Refer to vi(1) for a description of the command line options.)

The extensions to a.vi are modeled after the standard vi support for C source files. In particular, the “%”, “[[”, and “]]”, and “^]” commands have been modified and two new commands, “*”, for syntactic closure, and “^O”, for finding specifications of tags, have been added.

A.vi has three new options not found in standard vi: ada, adapath, and atags. These options can be set in the same way as the standard vi options; either from within a.vi or from your .exrc file. Note that ada is a toggle option, while adapath and atags are string options (pathnames). A space or tab character in string options must be escaped using a “\”. If the adapath is not set, a.vi sets it, if possible, using the adapath found in the local ada.lib file (see the VADS Operations Manual if the Ada compiler ada(1) is installed on your system). A.vi also sets the atags path from the information in the ada.lib file, if that option is not already set.

A.vi will search the directories in your adapath for any files specified either on the command line, when a.vi is invoked, or as arguments to commands issued within a.vi. If the file is not found in any directory in adapath, a.vi assumes the file is a new one.

The tags commands in a.vi are compatible with a.tags(1), which produces a special Ada tags file called atags. A.vi first checks the atags file in your local directory for the tag. If a unique tag is found, the proper file is displayed. If the tag is not found, a.vi checks all other tag files on the atags path for the tag. If the tag is still not found, a.vi then checks all the tags files along the tags path. (The tags option in a.vi is identical to the one in 4.2bsd vi.) If multiple instances of a tag are found in the atags or tags file (as in the case of overloaded procedures), a.vi will enter a special mode and present a list of tags. The user can then scan through the list and select the desired tag using the following commands:

j   move down in the list

k   move up in the list

CR  accept the displayed tag

n   check next tag file

ESC abort the tags command

Other keystrokes will give an error indication.

COMMANDS
If vi is invoked as a.vi or if the ada option is set, vi assumes it is editing Ada source, and accepts the following commands.

%   finds the matching end when the cursor is placed on: if, for, while, loop, case, record, select, function, procedure, package, or task. In the case of procedures, functions, packages, tasks, and declares, the matching end must have the “optional” identifier.

    ``%'' also searches back from the “e” of end if, end loop, end case, end record, end select, and end xxxx (where xxxx is the name of a function, procedure, package, task, or declare) to find the corresponding if, for, while, loop, case, record, select, function, procedure, package, or task. When matching an end loop, a.vi finds the corresponding while or for if they are on the same line as the loop. Otherwise, a.vi simply matches the corresponding loop.

    “%” finds matching parentheses and braces (``{}'') as it does in C.

[[ ]]
    move up and down (respectively) in the source file to the next procedure, function, package, task, or declare block.

^]  tags command to read all of a qualified name. For example, if the cursor were placed on the “f” of foo.bar.snik, a.vi will look up the entire qualified name, foo.bar.snik in the tags file. (It is possible to specify a maximum tag length as a regular vi option.)

^O  similar to “^]” except that it finds the tag with “s#” prepended. That is, it finds the specification of the tag, rather than the body.

*   provides syntactic closure for procedure, function, package, task, declare, select, record, if, while, for, and loop. While in command mode, place the cursor on or near the line(s) you want analyzed and closed. For example, if the procedure heading is three lines long, place the cursor on the top line and type “*”. Closure is performed if appropriate. By default, the “*” command searches forwards for six lines. A count may be specified for larger searches (e.g.“9*”).

    Example:

    Given:
        procedure big_foo(a:integer; b:integer) is

        “*” finishes it off as:

        procedure big_foo(a:integer; b:integer) is
        ``begin''

        end big_foo;

    and leaves the cursor on begin. You may use the undo (“u”) command if you change your mind about closure.

NOTES
A.vi is case sensitive.

Procedures, functions, and packages do not have to start in column 1, as in C.

A.vi searches for keywords and usually skips the ones in comments, in strings, and embedded in other text.

A.vi will also handle split lines with autoindent turned on.

FILES
/usr/lib/ex?.?strings    error messages
/usr/lib/ex?.?recover    recover command
/usr/lib/ex?.?preserve    preserve command
/etc/termcap    describes capabilities of terminals
~/.exrc    editor startup file
/tmp/Vinnnnnn    editor temporary
/tmp/Rinnnnnn    named buffer temporary
/usr/preserve    preservation directory

SEE ALSO
a.tags(1), ex(1), vi(1)