Commit | Line | Data |
---|---|---|
0d19c241 JH |
1 | .\" Copyright (c) 1994 |
2 | .\" The Regents of the University of California. All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
178c26c5 | 32 | .\" @(#)vi.1 8.7 (Berkeley) 1/23/94 |
0d19c241 | 33 | .\" |
178c26c5 | 34 | .Dd "January 23, 1994" |
0d19c241 JH |
35 | .Dt EX/VI 1 |
36 | .Os | |
37 | .Sh Name | |
38 | .Nm ex, vi, view | |
39 | .Nd text editors | |
40 | .Sh SYNOPSIS | |
41 | .Nm vi | |
42 | .Op Fl eFlRv | |
43 | .Op Fl c Ar command | |
44 | .Op Fl r Ar file | |
45 | .Op Fl t Ar tag | |
46 | .Op Fl w Ar size | |
47 | .Op Fl x Ar aw | |
48 | .br | |
49 | .Nm view | |
50 | .Op Fl eFlRv | |
51 | .Op Fl c Ar command | |
52 | .Op Fl r Ar file | |
53 | .Op Fl t Ar tag | |
54 | .Op Fl w Ar size | |
55 | .Op Fl x Ar aw | |
56 | .br | |
57 | .Nm ex | |
58 | .Op Fl eFlRsv | |
59 | .Op Fl c Ar command | |
60 | .Op Fl r Ar file | |
61 | .Op Fl t Ar tag | |
62 | .Op Fl w Ar size | |
63 | .Op Fl x Ar aw | |
64 | .Sh DESCRIPTION | |
178c26c5 | 65 | .Nm "Ex" |
0d19c241 JH |
66 | is a line-oriented text editor. |
67 | .Nm Vi | |
68 | is a screen oriented text editor, based on | |
69 | .Nm ex . | |
70 | .Nm View | |
71 | is the same as using the | |
72 | .Fl R | |
73 | (read-only) option of | |
74 | .Nm vi . | |
178c26c5 | 75 | .Nm "Ex" |
0d19c241 JH |
76 | and |
77 | .Nm vi | |
78 | are really different interfaces to the same program, | |
79 | and it is possible to switch back and forth during the same edit session. | |
80 | .Pp | |
81 | This manual page is the one provided with the | |
82 | .Nm nex | |
83 | and | |
84 | .Nm nvi | |
85 | versions of the vi text editors. | |
86 | .Nm Nex | |
87 | and | |
88 | .Nm nvi | |
89 | are intended as bug-for-bug compatible replacements for the original | |
90 | Fourth Berkeley Software Distribution (4BSD) | |
91 | .Nm ex | |
92 | and | |
93 | .Nm vi | |
94 | programs. | |
95 | .Pp | |
96 | The following options are available: | |
97 | .Bl -tag -width indent | |
98 | .It Fl c | |
99 | Execute | |
100 | .Ar command | |
101 | immediately after starting the edit session. | |
102 | Useful for initial positioning in the file, but | |
103 | .Ar command | |
104 | is not limited to positioning commands. | |
105 | This is the POSIX 1003.2 interface for the historic | |
178c26c5 | 106 | .Dq "+command" |
0d19c241 JH |
107 | syntax. |
108 | .Nm Nex/nvi | |
109 | supports both the old and new syntax. | |
110 | .It Fl e | |
111 | Start editing in ex mode, as if the command name was | |
112 | .Nm ex . | |
113 | .It Fl F | |
114 | Don't copy the entire file when first starting to edit. | |
115 | (The default is to make a copy in case someone else tries to edit | |
116 | the file too.) | |
117 | .It Fl l | |
118 | List the files that may be recovered using the | |
119 | .Fl r | |
120 | option of | |
121 | .Nm vi . | |
122 | This is the new interface for the historic | |
123 | .Fl r | |
124 | without a file argument syntax. | |
125 | .Nm Nex/nvi | |
126 | supports both the old and new syntax. | |
127 | .It Fl R | |
128 | Start editing in read-only mode, as if the command name was | |
129 | .Nm view . | |
130 | .It Fl r | |
131 | Recover the specified file. | |
132 | .It Fl s | |
133 | Enter batch mode; applicable only to | |
134 | .Nm ex | |
135 | edit sessions. | |
136 | Batch mode is useful when running | |
137 | .Nm ex | |
138 | scripts. | |
139 | Prompts, informative messages and other user oriented things are | |
140 | turned off. | |
141 | This is the POSIX 1003.2 interface for the historic | |
142 | .Fl \- | |
143 | syntax. | |
144 | .Nm Nex/nvi | |
145 | supports both the old and new syntax. | |
146 | .It Fl t | |
147 | Start editing at the specified tag. | |
148 | (See | |
149 | .Xr ctags 1 ). | |
150 | .It Fl w | |
151 | Set the initial window size to the specified number of lines. | |
152 | .It Fl v | |
153 | Start editing in vi mode, as if the command name was | |
154 | .Nm vi | |
155 | or | |
156 | .Nm view . | |
157 | .It Fl x | |
158 | Reserved for X11 interfaces. | |
159 | Not currently implemented. | |
160 | .Sh ADDITIONAL FEATURES | |
161 | This manual page is the one distributed with the | |
162 | .Nm nvi | |
163 | and | |
164 | .Nm nex | |
165 | reimplementations of | |
166 | .Nm ex/vi . | |
167 | There are a few additional features in | |
168 | .Nm nex/nvi . | |
169 | .Bl -tag -width indent | |
170 | .It "8-bit clean data, large lines, files" | |
171 | .Nm Nvi/nex | |
172 | will edit any format file. | |
173 | Line lengths are limited by available memory, | |
174 | and file sizes are limited by available disk space. | |
175 | The command | |
178c26c5 | 176 | .Dq "^Vx[0-9A-Fa-f]* ," |
0d19c241 JH |
177 | in input mode, will insert any |
178 | legal character value into the text. | |
179 | .It "Split screens" | |
180 | The command | |
178c26c5 | 181 | .Dq ":sp[lit] [file ...]" |
0d19c241 JH |
182 | splits the screen in vi mode. |
183 | The key | |
178c26c5 | 184 | .Dq "^W" |
0d19c241 JH |
185 | switches between the foreground screens, |
186 | and the | |
178c26c5 | 187 | .Dq ":resize count" |
0d19c241 JH |
188 | command can be used to grow or shrink any |
189 | particular screen. | |
190 | .It "Background and foreground screens" | |
191 | The command | |
178c26c5 | 192 | .Dq ":bg" |
0d19c241 JH |
193 | backgrounds the current screen, |
194 | and the command | |
178c26c5 | 195 | .Dq ":fg [file]" |
0d19c241 JH |
196 | foregrounds the backgrounded screeen |
197 | that is editing the specified file, or, by default, the first background | |
198 | screen on the queue. | |
199 | The command | |
178c26c5 | 200 | .Dq ":di[splay] s[creens]" |
0d19c241 JH |
201 | lists the background screens. |
202 | .It "Shell screens" | |
203 | The command | |
178c26c5 | 204 | .Dq ":sc[ript] [file ...]" |
0d19c241 JH |
205 | runs a shell in the screen. |
206 | Editing is unchanged, with the exception that a <carriage-return> | |
207 | enters the current line (stripped of any prompt) as input to the | |
208 | shell. | |
209 | .It "Tag stacks" | |
210 | Tags are now maintained in a stack. | |
211 | The command | |
178c26c5 | 212 | .Dq "^T" |
0d19c241 JH |
213 | returns to the previous tag location. |
214 | The command | |
178c26c5 | 215 | .Dq ":tagpop [number \| file]" |
0d19c241 JH |
216 | returns to the most recent tag |
217 | location by default, or, optionally to a specific tag number in the | |
218 | tag stack, or the most recent tag from the specified file. | |
219 | Use the command | |
178c26c5 | 220 | .Dq ":di[splay] t[ags]" |
0d19c241 JH |
221 | to view the tags stack. |
222 | The command | |
178c26c5 | 223 | .Dq ":tagtop" |
0d19c241 JH |
224 | returns to the top of the tag stack. |
225 | .It "New displays" | |
226 | The command | |
178c26c5 | 227 | .Dq ":di[splay] b[uffers] \| s[creens] \| t[ags]" |
0d19c241 JH |
228 | can be |
229 | used to display, respectively, the current cut buffers, | |
230 | the backgrounded screens, and the tags stack. | |
231 | .It "Infinite undo" | |
232 | The changes made during an edit session may be rolled backward and | |
233 | forward. | |
234 | A '.' command immediately after a 'u' command continues either forward | |
235 | or backward depending on whether the 'u' command was an undo or a redo. | |
236 | .It "Usage information" | |
237 | The command | |
178c26c5 | 238 | .Dq ":exu[sage [cmd]" |
0d19c241 | 239 | and |
178c26c5 | 240 | .Dq "viu[sage] [key]" |
0d19c241 JH |
241 | provide usage |
242 | information for all of the ex and vi commands by default, or, optionally, | |
243 | for a specific command or key. | |
244 | .It "Extended regular expressions" | |
245 | The | |
178c26c5 | 246 | .Dq ":set extended" |
0d19c241 JH |
247 | command treats search and other command regular |
248 | expressions as extended (egrep(1) style) regular expressions. | |
249 | .It "Word search" | |
250 | The command | |
178c26c5 | 251 | .Dq "^A" |
0d19c241 JH |
252 | searches for the word referenced by the cursor. |
253 | .It "Number increment" | |
254 | The command | |
178c26c5 | 255 | .Dq "#" |
0d19c241 JH |
256 | increments the number referenced by the cursor. |
257 | .It "Previous file" | |
258 | The command | |
178c26c5 | 259 | .Dq ":prev[ious][!]" |
0d19c241 JH |
260 | edits the previous file from the |
261 | argument list. | |
262 | .It "Left-Right scrolling" | |
263 | The command | |
178c26c5 | 264 | .Dq ":set leftright" |
0d19c241 JH |
265 | makes |
266 | .Nm nvi | |
267 | do left-right screen scrolling, instead of the traditional | |
268 | .Nm vi | |
269 | line wrapping. | |
270 | .Sh RECOVERY | |
271 | There is no recovery program for nvi, nor does it run setuid. | |
272 | Users may recover any file which they may read, and the superuser | |
273 | may recover any edit session. | |
274 | .Pp | |
275 | Edit sessions are backed by files in | |
276 | .Pa /var/tmp/vi.recover , | |
277 | and are named | |
178c26c5 | 278 | .Dq "vi.XXXX" , |
0d19c241 | 279 | where |
178c26c5 | 280 | .Dq "XXXX" |
0d19c241 JH |
281 | is a number related to the process id. |
282 | When a file is first modified, a second file, which contains an | |
283 | email message for the user, is created, and is named | |
178c26c5 | 284 | .Dq "recover.XXXX" , |
0d19c241 | 285 | where, again, |
178c26c5 | 286 | .Dq "XXXX" |
0d19c241 JH |
287 | is associated with the process id. |
288 | Both files are removed at the end of a normal edit session, | |
289 | but will remain if the edit session is abnormally terminated | |
290 | or the user enters the ex/vi | |
178c26c5 | 291 | .Dq "preserve" |
0d19c241 JH |
292 | command. |
293 | The use of the | |
294 | .Pa /var/tmp | |
295 | directory may be changed setting the option | |
178c26c5 | 296 | .Dq "recdir" |
0d19c241 JH |
297 | in the user's or system startup information. |
298 | .Pp | |
299 | The recovery directory should have the | |
178c26c5 | 300 | .Dq "sticky-bit" |
0d19c241 JH |
301 | set so that only the owners of files may remove them. |
302 | If this is not possible on the system, then a pseudo-user should | |
303 | own the recovery directory. | |
304 | The recovery directory must be both read and write-able by | |
305 | any user. | |
306 | .Pp | |
307 | The recovery file has all of the necessary information in it to enable the | |
308 | user to recover the edit session. | |
309 | In addition, it has all of the necessary email headers for sendmail. | |
310 | When the system is rebooted, all of the files in | |
311 | .Pa /var/tmp/vi.recover | |
312 | named | |
178c26c5 | 313 | .Dq "recover.XXXX" |
0d19c241 JH |
314 | should be sent by email, |
315 | using the | |
316 | .Fl t | |
317 | flag of sendmail (or a similar mechanism in other mailers). | |
318 | A simple way to do this is to insert the following script into your | |
178c26c5 | 319 | rc.local (or other startup) file: |
0d19c241 JH |
320 | .sp |
321 | .ne 7v | |
322 | .Bd -literal -offset indent -compact | |
323 | # Recover nvi editor files. | |
324 | virecovery=/var/tmp/vi.recover/recover.* | |
178c26c5 | 325 | if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then |
0d19c241 JH |
326 | echo 'Recovering vi editor sessions' |
327 | for i in $virecovery; do | |
328 | sendmail -t < $i | |
329 | done | |
178c26c5 | 330 | fi |
0d19c241 JH |
331 | .Ed |
332 | .Pp | |
333 | If | |
334 | .Nm nex/nvi | |
335 | receives a hangup (SIGHUP) signal, it will email the recovery | |
336 | information to the user itself. | |
337 | .Pp | |
338 | If you don't have the sendmail program on your system, the source file | |
339 | .Pa nvi/recover.c | |
340 | will have to be modified to use your mail delivery programs. | |
341 | .Sh BUGS | |
342 | This man page is woefully incomplete. | |
343 | .Pp | |
344 | Many and varied. | |
345 | See the file | |
178c26c5 | 346 | .Pa nvi/docs/bugs.current |
0d19c241 JH |
347 | for a list of the known bugs in this version. |
348 | .Sh FILES | |
349 | .Bl -tag -width XXXX/var/tmp/vi.recover -compact | |
350 | .It Pa /tmp | |
351 | Storage for temporary files. | |
352 | .It Pa /var/tmp/vi.recover | |
353 | Storage for recovery files. | |
354 | .El | |
355 | .Sh SEE ALSO | |
356 | .Xr ctags 1 , | |
357 | .Xr more 1 , | |
358 | .Xr curses 3 , | |
359 | .Xr dbopen 3 | |
360 | .sp | |
361 | The | |
178c26c5 | 362 | .Dq "Vi Quick Reference" |
0d19c241 JH |
363 | card. |
364 | .sp | |
178c26c5 | 365 | .Dq "An Introduction to Display Editing with Vi" , |
0d19c241 | 366 | found in the |
178c26c5 | 367 | .Dq "UNIX User's Manual Supplementary Documents" . |
0d19c241 | 368 | .sp |
178c26c5 | 369 | .Dq "Edit: A tutorial" , |
0d19c241 | 370 | found in the |
178c26c5 | 371 | .Dq "UNIX User's Manual Supplementary Documents" . |
0d19c241 | 372 | .sp |
178c26c5 | 373 | .Dq "Ex Reference Manual (Version 3.7)" , |
0d19c241 | 374 | found in the |
178c26c5 JH |
375 | .Dq "UNIX User's Manual Supplementary Documents" . |
376 | .Pp | |
377 | .Nm Nroff/troff | |
378 | source for the previous three documents are distributed with | |
379 | .Nm nex/nvi | |
380 | in the | |
381 | .Pa nvi/docs/USD.doc | |
382 | directory of the | |
383 | .Nm nex/nvi | |
384 | source code. | |
0d19c241 JH |
385 | .sp |
386 | The files | |
178c26c5 JH |
387 | .Dq "autowrite" , |
388 | .Dq "input" , | |
0d19c241 | 389 | and |
178c26c5 | 390 | .Dq "quoting" , |
0d19c241 JH |
391 | found in the |
392 | .Pa nvi/docs | |
393 | directory of the | |
394 | .Nm nex/nvi | |
395 | source code. | |
396 | .Sh HISTORY | |
397 | The | |
398 | .Nm nex/nvi | |
399 | replacements for | |
400 | .Nm ex/vi | |
401 | first appeared in 4.4BSD. | |
402 | .Sh STANDARDS | |
403 | .Nm Nex/nvi | |
404 | is fairly close to IEEE Std1003.2 (``POSIX''), but it's | |
405 | not there yet. |