.\" The Regents of the University of California. All rights reserved.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" @(#)vi.1 8.7 (Berkeley) 1/23/94
is a line-oriented text editor.
is a screen oriented text editor, based on
are really different interfaces to the same program,
and it is possible to switch back and forth during the same edit session.
This manual page is the one provided with the
versions of the vi text editors.
are intended as bug-for-bug compatible replacements for the original
Fourth Berkeley Software Distribution (4BSD)
The following options are available:
immediately after starting the edit session.
Useful for initial positioning in the file, but
is not limited to positioning commands.
This is the POSIX 1003.2 interface for the historic
supports both the old and new syntax.
Start editing in ex mode, as if the command name was
Don't copy the entire file when first starting to edit.
(The default is to make a copy in case someone else tries to edit
List the files that may be recovered using the
This is the new interface for the historic
without a file argument syntax.
supports both the old and new syntax.
Start editing in read-only mode, as if the command name was
Recover the specified file.
Enter batch mode; applicable only to
Batch mode is useful when running
Prompts, informative messages and other user oriented things are
This is the POSIX 1003.2 interface for the historic
supports both the old and new syntax.
Start editing at the specified tag.
Set the initial window size to the specified number of lines.
Start editing in vi mode, as if the command name was
Reserved for X11 interfaces.
Not currently implemented.
This manual page is the one distributed with the
There are a few additional features in
.It "8-bit clean data, large lines, files"
will edit any format file.
Line lengths are limited by available memory,
and file sizes are limited by available disk space.
in input mode, will insert any
legal character value into the text.
.Dq ":sp[lit] [file ...]"
splits the screen in vi mode.
switches between the foreground screens,
command can be used to grow or shrink any
.It "Background and foreground screens"
backgrounds the current screen,
foregrounds the backgrounded screeen
that is editing the specified file, or, by default, the first background
.Dq ":di[splay] s[creens]"
lists the background screens.
.Dq ":sc[ript] [file ...]"
runs a shell in the screen.
Editing is unchanged, with the exception that a <carriage-return>
enters the current line (stripped of any prompt) as input to the
Tags are now maintained in a stack.
returns to the previous tag location.
.Dq ":tagpop [number \| file]"
returns to the most recent tag
location by default, or, optionally to a specific tag number in the
tag stack, or the most recent tag from the specified file.
returns to the top of the tag stack.
.Dq ":di[splay] b[uffers] \| s[creens] \| t[ags]"
used to display, respectively, the current cut buffers,
the backgrounded screens, and the tags stack.
The changes made during an edit session may be rolled backward and
A '.' command immediately after a 'u' command continues either forward
or backward depending on whether the 'u' command was an undo or a redo.
information for all of the ex and vi commands by default, or, optionally,
for a specific command or key.
.It "Extended regular expressions"
command treats search and other command regular
expressions as extended (egrep(1) style) regular expressions.
searches for the word referenced by the cursor.
increments the number referenced by the cursor.
edits the previous file from the
.It "Left-Right scrolling"
do left-right screen scrolling, instead of the traditional
There is no recovery program for nvi, nor does it run setuid.
Users may recover any file which they may read, and the superuser
may recover any edit session.
Edit sessions are backed by files in
.Pa /var/tmp/vi.recover ,
is a number related to the process id.
When a file is first modified, a second file, which contains an
email message for the user, is created, and is named
is associated with the process id.
Both files are removed at the end of a normal edit session,
but will remain if the edit session is abnormally terminated
or the user enters the ex/vi
directory may be changed setting the option
in the user's or system startup information.
The recovery directory should have the
set so that only the owners of files may remove them.
If this is not possible on the system, then a pseudo-user should
own the recovery directory.
The recovery directory must be both read and write-able by
The recovery file has all of the necessary information in it to enable the
user to recover the edit session.
In addition, it has all of the necessary email headers for sendmail.
When the system is rebooted, all of the files in
flag of sendmail (or a similar mechanism in other mailers).
A simple way to do this is to insert the following script into your
rc.local (or other startup) file:
.Bd -literal -offset indent -compact
# Recover nvi editor files.
virecovery=/var/tmp/vi.recover/recover.*
if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
echo 'Recovering vi editor sessions'
receives a hangup (SIGHUP) signal, it will email the recovery
information to the user itself.
If you don't have the sendmail program on your system, the source file
will have to be modified to use your mail delivery programs.
This man page is woefully incomplete.
.Pa nvi/docs/bugs.current
for a list of the known bugs in this version.
.Bl -tag -width XXXX/var/tmp/vi.recover -compact
Storage for temporary files.
.It Pa /var/tmp/vi.recover
Storage for recovery files.
.Dq "An Introduction to Display Editing with Vi" ,
.Dq "UNIX User's Manual Supplementary Documents" .
.Dq "UNIX User's Manual Supplementary Documents" .
.Dq "Ex Reference Manual (Version 3.7)" ,
.Dq "UNIX User's Manual Supplementary Documents" .
source for the previous three documents are distributed with
first appeared in 4.4BSD.
is fairly close to IEEE Std1003.2 (``POSIX''), but it's