Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (v - z) vi(1)
• 128 bytes in a shell escape command.
• 128 bytes in a string-valued option.
• 30 bytes in a tag name.
• 128 map macros with 2048 bytes total.
Editing Modes
The vi editor has the following operational modes:
Command mode
When you start the vi editor, it is in Command mode. Any subcommand can be entered
from this mode, except commands that can only be used in the Text Input mode (those
subcommands that make corrections during text insertion). When subcommands and
the other modes end, vi returns to Command mode. Pressing <Esc> cancels a partial
subcommand.
Text Input mode
Entered by the a, A, i, I, o, O, cx (where x represents the scope of the subcommand), C,
s, S, and R subcommands. After entering one of these commands, you can enter text
into the editing buffer at the current cursor position. To return to Command mode,
press <Esc> for normal exit or press the Interrupt key sequence to end abruptly.
Setting Options
The vi editor allows you to customize options so that you can use the editor for a specific task.
Use the set command to set or change an option. To view the current setting of options, enter
:set all while in vi Command mode.
Some options are set to a string or a number value; other options are simply turned on or off. To
change an option that is set to a value, enter a command in the form :set option=value. To toggle
an option that can be set to on or off, enter a line of the form :set option to set it to on or :set
nooption to set it to off.
Options can be abbreviated in a set command. The following list describes some of vi’s options,
along with their abbreviations and descriptions:
[no]autoindent (ai)
Indents automatically in Text mode to the indentation on the previous line by using the
spacing between tab stops specified by the shiftwidth option. The default is noai.To
back the cursor up to the previous tab stop, type <Ctrl-d>. This option is not in effect
for global commands.
[no]autoprint (ap)
Prints the current line after any command that changes the editing buffer. The default is
ap. This option applies only to the last command in a sequence of commands on a sin-
gle line, and is not in effect for global commands.
[no]autowrite (aw)
Writes the editing buffer to the file automatically before the :e, :n, :ta, :rew, :st, :su,
<Ctrl-a>, and ! subcommands if the editing buffer was changed since the last write
command. The default is noaw.
[no]beautify (bf)
Prevents user from entering control characters (except for tab, newline, and formfeed)
in the editing buffer during text entry. The default is nobf. This option does apply to
command input. If beautify is set, all nonprintable characters other than the Tab, new-
line, and formfeed characters are discarded from text read in from files.
527188-004 Hewlett-Packard Company 10−3