tvi Command

Purpose

Provides a trusted editor with a full screen display.

Syntax

tvi [ - l ] [ -R ] [ -w Number ] [ -c [ Subcommand ] ] [ File ... ]

Description

The tvi command calls the tvi editor, a trusted version of the vi editor, to edit the file or files specified by the File parameter. Files are edited in the order specified. If you do not provide a file name, the command opens a new file in which you can create text, but if you try to save the text to a file, you are prompted to add a file name to the save command, such as :w File. See the Examples section for more information.

You enter and leave the tvi editor in command mode, but to add or change text, you must enter text input mode. See the description of text input mode for information about the subcommands that initiate text input mode. To leave text input mode, press the Esc key. This returns you to command mode where you can save the text to a file with one of the :w commands, and exit the tvi editor, for example, with the :q command.

Because the full-screen display editor started by the tvi command is based on the ex editor, you can use the ex subcommands within the tvi editor. Subcommands function at the cursor position on the display screen.

The tvi editor makes a copy of the file you are editing in an edit buffer. The contents of the file are not changed until you save the changes.

Note: Several functions of the vi editor are not supported by the tvi editor. If you refer to information on the vi editor, be aware that the -r flag, the -t flag, shell escapes, user-defined macros, key mapping, and setting vi options permanently are not supported by the tvi editor.

tvi Editor Limitations

The maximum limits of the tvi editor assume single-byte characters. The limits are as follows:

Editing Modes

The tvi editor operates in the following modes:

Item Description
command mode The tvi editor starts in command mode. Any subcommand can be called except those that only correct text during text input mode. To see a description of the subcommands, refer to the topics in Subcommands for the tvi Editor. To identify the subcommands that cannot be called from command mode, refer to Changing Text While in Input Mode. The tvi editor returns to command mode when subcommands and other modes end. Press the Esc key to cancel a partial subcommand.
text input mode The tvi editor enters text input mode when you use a permitted command that adds or changes text. To see a list of subcommands that initiate text input mode, refer to Adding Text to a File and the subcommands that change text from command mode, the C subcommand and the cx subcommands. After entering one of these subcommands, you can edit text with any of the subcommands that function in text input mode. To see a description of the subcommands, refer to the topics in "Subcommands for the tvi Editor". To return to command mode from text input mode, press the Esc key for a typical exit or press the Ctrl+C keys to create an INTERRUPT signal.
last line mode Some subcommands read input on a line displayed at the bottom of the screen. These subcommands include those with the prefix : (colon), / (slash), and ? (question mark). When you enter the initial character, the tvi editor places the cursor at the bottom of the screen so you can enter the remaining command characters. To run the subcommand, press the Enter key. To cancel the subcommand, press the Ctrl+C keys to create an INTERRUPT signal. When you use the : (colon) to enter last line mode, the following characters have special meaning when used before commands that specify counts:
%
All lines regardless of cursor position
$
Last line
.
Current line

Customizing the tvi Editor

You can customize the tvi editor on a temporary basis by following the directions in "Setting vi Editor Options". The section on "Setting vi Options Permanently" is not applicable to the tvi editor.

Subcommands for the tvi Editor

Information on vi editor subcommands that are applicable to the tvi editor is summarized in the following list:

Flags

Item Description
-c [Subcommand] Carries out the ex editor subcommand before editing begins. This provides a line-oriented text editor. When a null operand is entered for the Subcommand parameter, as in -c '', the editor places the cursor on the last line of the file.
-l Enters the editor in LISP mode. In this mode, the editor indents appropriately for LISP code, and the (, ), {, }, [[, and ]] subcommands are modified to act appropriately for LISP. These subcommands place the cursor at the specified LISP function. For more information on the LISP subcommands, refer to Moving to Sentences, Paragraphs, and Sections.
-R Sets the readonly option to protect the file against overwriting.
-w Number Sets the default window size to the value specified by the Number parameter. This is useful when you use the editor over a low-speed line.
+ [Subcommand] Same as the -c Subcommand.

Security

Access Control: This command should grant execute (x) access to all users and have the trusted computing base attribute.

Auditing Events:

Event Information
TVI filename

Examples

  1. To call a trusted editor to edit the plans file, type:
    tvi plans
    This command puts the tvi editor into command mode. To add or change text, you must enter text input mode or use a command accepted in command mode. For more information, refer to the description of text input mode.
  2. To save the text you create with the tvi editor, leave text input mode by pressing the Esc key, and then enter one of the save commands :w, :w File, or :w! File, for example:
    :w plans
    In this example, a file name, such as plans, is needed if you gave the tvi command without specifying a file name. If the file is already named, the :w command would not need the File parameter. If you want to overwrite an existing file, use the :w! File command, specifying the file you want to overwrite with the File parameter.

    If you try to save an unnamed file without supplying a file name, the following message appears:

    No current filename
    If this happens, repeat the :w command with a file name.
  3. To exit the tvi editor from text input mode, press the Esc key to type command mode, and then type:
    :q!
    If the editor already is in command mode, you do not need to press the Esc key before giving the quit (q!) command.

Files

Item Description
/usr/bin/tvi Contains the tvi command.