2 .\" The Regents of the University of California. All rights reserved.
4 .\" %sccs.include.redist.roff%
6 .\" $Id: vi.ref,v 8.7 1994/01/23 17:49:36 bostic Exp $ (Berkeley) $Date: 1994/01/23 17:49:36 $
40 is a line-oriented text editor.
42 is a screen oriented text editor, based on
45 is the same as using the
52 are really different interfaces to the same program,
53 and it is possible to switch back and forth during the same edit session.
55 This manual page is the one provided with the
59 versions of the vi text editors.
63 are intended as bug-for-bug compatible replacements for the original
64 Fourth Berkeley Software Distribution (4BSD)
70 The following options are available:
71 .Bl -tag -width indent
75 immediately after starting the edit session.
76 Useful for initial positioning in the file, but
78 is not limited to positioning commands.
79 This is the POSIX 1003.2 interface for the historic
83 supports both the old and new syntax.
85 Start editing in ex mode, as if the command name was
88 Don't copy the entire file when first starting to edit.
89 (The default is to make a copy in case someone else tries to edit
92 List the files that may be recovered using the
96 This is the new interface for the historic
98 without a file argument syntax.
100 supports both the old and new syntax.
102 Start editing in read-only mode, as if the command name was
105 Recover the specified file.
107 Enter batch mode; applicable only to
110 Batch mode is useful when running
113 Prompts, informative messages and other user oriented things are
115 This is the POSIX 1003.2 interface for the historic
119 supports both the old and new syntax.
121 Start editing at the specified tag.
125 Set the initial window size to the specified number of lines.
127 Start editing in vi mode, as if the command name was
132 Reserved for X11 interfaces.
133 Not currently implemented.
134 .Sh ADDITIONAL FEATURES
135 This manual page is the one distributed with the
141 There are a few additional features in
143 .Bl -tag -width indent
144 .It "8-bit clean data, large lines, files"
146 will edit any format file.
147 Line lengths are limited by available memory,
148 and file sizes are limited by available disk space.
150 .Dq "^Vx[0-9A-Fa-f]* ,"
151 in input mode, will insert any
152 legal character value into the text.
155 .Dq ":sp[lit] [file ...]"
156 splits the screen in vi mode.
159 switches between the foreground screens,
162 command can be used to grow or shrink any
164 .It "Background and foreground screens"
167 backgrounds the current screen,
170 foregrounds the backgrounded screeen
171 that is editing the specified file, or, by default, the first background
174 .Dq ":di[splay] s[creens]"
175 lists the background screens.
178 .Dq ":sc[ript] [file ...]"
179 runs a shell in the screen.
180 Editing is unchanged, with the exception that a <carriage-return>
181 enters the current line (stripped of any prompt) as input to the
184 Tags are now maintained in a stack.
187 returns to the previous tag location.
189 .Dq ":tagpop [number \| file]"
190 returns to the most recent tag
191 location by default, or, optionally to a specific tag number in the
192 tag stack, or the most recent tag from the specified file.
194 .Dq ":di[splay] t[ags]"
195 to view the tags stack.
198 returns to the top of the tag stack.
201 .Dq ":di[splay] b[uffers] \| s[creens] \| t[ags]"
203 used to display, respectively, the current cut buffers,
204 the backgrounded screens, and the tags stack.
206 The changes made during an edit session may be rolled backward and
208 A '.' command immediately after a 'u' command continues either forward
209 or backward depending on whether the 'u' command was an undo or a redo.
210 .It "Usage information"
212 .Dq ":exu[sage [cmd]"
214 .Dq "viu[sage] [key]"
216 information for all of the ex and vi commands by default, or, optionally,
217 for a specific command or key.
218 .It "Extended regular expressions"
221 command treats search and other command regular
222 expressions as extended (egrep(1) style) regular expressions.
226 searches for the word referenced by the cursor.
227 .It "Number increment"
230 increments the number referenced by the cursor.
234 edits the previous file from the
236 .It "Left-Right scrolling"
241 do left-right screen scrolling, instead of the traditional
245 There is no recovery program for nvi, nor does it run setuid.
246 Users may recover any file which they may read, and the superuser
247 may recover any edit session.
249 Edit sessions are backed by files in
250 .Pa /var/tmp/vi.recover ,
255 is a number related to the process id.
256 When a file is first modified, a second file, which contains an
257 email message for the user, is created, and is named
261 is associated with the process id.
262 Both files are removed at the end of a normal edit session,
263 but will remain if the edit session is abnormally terminated
264 or the user enters the ex/vi
269 directory may be changed setting the option
271 in the user's or system startup information.
273 The recovery directory should have the
275 set so that only the owners of files may remove them.
276 If this is not possible on the system, then a pseudo-user should
277 own the recovery directory.
278 The recovery directory must be both read and write-able by
281 The recovery file has all of the necessary information in it to enable the
282 user to recover the edit session.
283 In addition, it has all of the necessary email headers for sendmail.
284 When the system is rebooted, all of the files in
285 .Pa /var/tmp/vi.recover
288 should be sent by email,
291 flag of sendmail (or a similar mechanism in other mailers).
292 A simple way to do this is to insert the following script into your
293 rc.local (or other startup) file:
296 .Bd -literal -offset indent -compact
297 # Recover nvi editor files.
298 virecovery=/var/tmp/vi.recover/recover.*
299 if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
300 echo 'Recovering vi editor sessions'
301 for i in $virecovery; do
309 receives a hangup (SIGHUP) signal, it will email the recovery
310 information to the user itself.
312 If you don't have the sendmail program on your system, the source file
314 will have to be modified to use your mail delivery programs.
316 This man page is woefully incomplete.
320 .Pa nvi/docs/bugs.current
321 for a list of the known bugs in this version.
323 .Bl -tag -width XXXX/var/tmp/vi.recover -compact
325 Storage for temporary files.
326 .It Pa /var/tmp/vi.recover
327 Storage for recovery files.
336 .Dq "Vi Quick Reference"
339 .Dq "An Introduction to Display Editing with Vi" ,
341 .Dq "UNIX User's Manual Supplementary Documents" .
343 .Dq "Edit: A tutorial" ,
345 .Dq "UNIX User's Manual Supplementary Documents" .
347 .Dq "Ex Reference Manual (Version 3.7)" ,
349 .Dq "UNIX User's Manual Supplementary Documents" .
352 source for the previous three documents are distributed with
375 first appeared in 4.4BSD.
378 is fairly close to IEEE Std1003.2 (``POSIX''), but it's