quot Nm statements so that "Ex" isn't interpreted as a mandoc macro
[nvi.git] / docs / vi.ref / vi.ref
blob2c395a45b4375d74e9a9c1d0c2400dd2b0f8e3e1
1 .\" Copyright (c) 1994
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" %sccs.include.redist.roff%
5 .\"
6 .\"     $Id: vi.ref,v 8.3 1994/01/13 17:50:34 bostic Exp $ (Berkeley) $Date: 1994/01/13 17:50:34 $
7 .\"
8 .Dd "%Q%"
9 .Dt EX/VI 1
10 .Os
11 .Sh Name
12 .Nm ex, vi, view
13 .Nd text editors
14 .Sh SYNOPSIS
15 .Nm vi
16 .Op Fl eFlRv
17 .Op Fl c Ar command
18 .Op Fl r Ar file
19 .Op Fl t Ar tag
20 .Op Fl w Ar size
21 .Op Fl x Ar aw
22 .br
23 .Nm view
24 .Op Fl eFlRv
25 .Op Fl c Ar command
26 .Op Fl r Ar file
27 .Op Fl t Ar tag
28 .Op Fl w Ar size
29 .Op Fl x Ar aw
30 .br
31 .Nm ex
32 .Op Fl eFlRsv
33 .Op Fl c Ar command
34 .Op Fl r Ar file
35 .Op Fl t Ar tag
36 .Op Fl w Ar size
37 .Op Fl x Ar aw
38 .Sh DESCRIPTION
39 .Nm "Ex"
40 is a line-oriented text editor.
41 .Nm Vi
42 is a screen oriented text editor, based on
43 .Nm ex .
44 .Nm View
45 is the same as using the
46 .Fl R
47 (read-only) option of
48 .Nm vi .
49 .Nm "Ex"
50 and
51 .Nm vi
52 are really different interfaces to the same program,
53 and it is possible to switch back and forth during the same edit session.
54 .Pp
55 This manual page is the one provided with the
56 .Nm nex
57 and
58 .Nm nvi
59 versions of the vi text editors.
60 .Nm Nex
61 and
62 .Nm nvi
63 are intended as bug-for-bug compatible replacements for the original
64 Fourth Berkeley Software Distribution (4BSD)
65 .Nm ex
66 and
67 .Nm vi
68 programs.
69 .Pp
70 The following options are available:
71 .Bl -tag -width indent
72 .It Fl c
73 Execute
74 .Ar command
75 immediately after starting the edit session.
76 Useful for initial positioning in the file, but
77 .Ar command
78 is not limited to positioning commands.
79 This is the POSIX 1003.2 interface for the historic
80 .Dq "+command"
81 syntax.
82 .Nm Nex/nvi
83 supports both the old and new syntax.
84 .It Fl e
85 Start editing in ex mode, as if the command name was
86 .Nm ex .
87 .It Fl F
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
90 the file too.)
91 .It Fl l
92 List the files that may be recovered using the
93 .Fl r
94 option of
95 .Nm vi .
96 This is the new interface for the historic
97 .Fl r
98 without a file argument syntax.
99 .Nm Nex/nvi
100 supports both the old and new syntax.
101 .It Fl R
102 Start editing in read-only mode, as if the command name was
103 .Nm view .
104 .It Fl r
105 Recover the specified file.
106 .It Fl s
107 Enter batch mode; applicable only to
108 .Nm ex
109 edit sessions.
110 Batch mode is useful when running
111 .Nm ex
112 scripts.
113 Prompts, informative messages and other user oriented things are
114 turned off.
115 This is the POSIX 1003.2 interface for the historic
116 .Fl \-
117 syntax.
118 .Nm Nex/nvi
119 supports both the old and new syntax.
120 .It Fl t
121 Start editing at the specified tag.
122 (See
123 .Xr ctags 1 ).
124 .It Fl w
125 Set the initial window size to the specified number of lines.
126 .It Fl v
127 Start editing in vi mode, as if the command name was
128 .Nm vi
130 .Nm view .
131 .It Fl x
132 Reserved for X11 interfaces.
133 Not currently implemented.
134 .Sh ADDITIONAL FEATURES
135 This manual page is the one distributed with the
136 .Nm nvi
138 .Nm nex
139 reimplementations of
140 .Nm ex/vi .
141 There are a few additional features in
142 .Nm nex/nvi .
143 .Bl -tag -width indent
144 .It "8-bit clean data, large lines, files"
145 .Nm Nvi/nex
146 will edit any format file.
147 Line lengths are limited by available memory,
148 and file sizes are limited by available disk space.
149 The command
150 .Dq "^Vx[0-9A-Fa-f]* ,"
151 in input mode, will insert any
152 legal character value into the text.
153 .It "Split screens"
154 The command
155 .Dq ":sp[lit] [file ...]"
156 splits the screen in vi mode.
157 The key
158 .Dq "^W"
159 switches between the foreground screens,
160 and the
161 .Dq ":resize count"
162 command can be used to grow or shrink any
163 particular screen.
164 .It "Background and foreground screens"
165 The command
166 .Dq ":bg"
167 backgrounds the current screen,
168 and the command
169 .Dq ":fg [file]"
170 foregrounds the backgrounded screeen
171 that is editing the specified file, or, by default, the first background
172 screen on the queue.
173 The command
174 .Dq ":di[splay] s[creens]"
175 lists the background screens.
176 .It "Shell screens"
177 The command
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
182 shell.
183 .It "Tag stacks"
184 Tags are now maintained in a stack.
185 The command
186 .Dq "^T"
187 returns to the previous tag location.
188 The command
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.
193 Use the command
194 .Dq ":di[splay] t[ags]"
195 to view the tags stack.
196 The command
197 .Dq ":tagtop"
198 returns to the top of the tag stack.
199 .It "New displays"
200 The command
201 .Dq ":di[splay] b[uffers] \| s[creens] \| t[ags]"
202 can be
203 used to display, respectively, the current cut buffers,
204 the backgrounded screens, and the tags stack.
205 .It "Infinite undo"
206 The changes made during an edit session may be rolled backward and
207 forward.
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"
211 The command
212 .Dq ":exu[sage [cmd]"
214 .Dq "viu[sage] [key]"
215 provide usage
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"
220 .Dq ":set extended"
221 command treats search and other command regular
222 expressions as extended (egrep(1) style) regular expressions.
223 .It "Word search"
224 The command
225 .Dq "^A"
226 searches for the word referenced by the cursor.
227 .It "Number increment"
228 The command
229 .Dq "#"
230 increments the number referenced by the cursor.
231 .It "Previous file"
232 The command
233 .Dq ":prev[ious][!]"
234 edits the previous file from the
235 argument list.
236 .It "Left-Right scrolling"
237 The command
238 .Dq ":set leftright"
239 makes
240 .Nm nvi
241 do left-right screen scrolling, instead of the traditional
242 .Nm vi
243 line wrapping.
244 .Sh RECOVERY
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 ,
251 and are named
252 .Dq "vi.XXXX" ,
253 where
254 .Dq "XXXX"
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
258 .Dq "recover.XXXX" ,
259 where, again,
260 .Dq "XXXX"
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
265 .Dq "preserve"
266 command.
267 The use of the
268 .Pa /var/tmp
269 directory may be changed setting the option
270 .Dq "recdir"
271 in the user's or system startup information.
273 The recovery directory should have the
274 .Dq "sticky-bit"
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
279 any user.
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
286 named
287 .Dq "recover.XXXX"
288 should be sent by email,
289 using the
290 .Fl t
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 file:
295 .ne 7v
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.\e* ]; then
300         echo 'Recovering vi editor sessions'
301         for i in $virecovery; do
302                 sendmail -t < $i
303         done
307 .Nm nex/nvi
308 receives a hangup (SIGHUP) signal, it will email the recovery
309 information to the user itself.
311 If you don't have the sendmail program on your system, the source file
312 .Pa nvi/recover.c
313 will have to be modified to use your mail delivery programs.
314 .Sh BUGS
315 This man page is woefully incomplete.
317 Many and varied.
318 See the file
319 .Pa nvi/docs/BUGS
320 for a list of the known bugs in this version.
321 .Sh FILES
322 .Bl -tag -width XXXX/var/tmp/vi.recover -compact
323 .It Pa /tmp
324 Storage for temporary files.
325 .It Pa /var/tmp/vi.recover
326 Storage for recovery files.
328 .Sh SEE ALSO
329 .Xr ctags 1 ,
330 .Xr more 1 ,
331 .Xr curses 3 ,
332 .Xr dbopen 3
335 .Dq "Vi Quick Reference"
336 card.
338 .Dq "An Introduction to Display Editing with Vi" ,
339 found in the
340 .Dq "UNIX User's Manual Supplementary Documents" .
342 .Dq "Edit: A tutorial" ,
343 found in the
344 .Dq "UNIX User's Manual Supplementary Documents" .
346 .Dq "Ex Reference Manual (Version 3.7)" ,
347 found in the
348 .Dq "UNIX User's Manual Supplementary Documents" .
350 The files
351 .Dq "autowrite" ,
352 .Dq "input" ,
354 .Dq "quoting" ,
355 found in the
356 .Pa nvi/docs
357 directory of the
358 .Nm nex/nvi
359 source code.
360 .Sh HISTORY
362 .Nm nex/nvi
363 replacements for
364 .Nm ex/vi
365 first appeared in 4.4BSD.
366 .Sh STANDARDS
367 .Nm Nex/nvi
368 is fairly close to IEEE Std1003.2 (``POSIX''), but it's
369 not there yet.