This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / share / doc / usd / 15.vi / vi.summary
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1980 The Regents of the University of California.
2.\" 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.\"
32.\" @(#)vi.summary 6.3 (Berkeley) 4/17/91
33.\"
34.ds CH
35.ds CF
36.de TS
37.br
38.if !\\n(1T .RT
39.ul 0
40.ti \\n(.iu
41.if t .sp 0.25
42.if n .sp
43.if \a\\$1\aH\a .TQ
44.nr IX 1
45..
46.nr PS 9
47.ps 9
48.nr VS 11
49.vs 11
50.nr HM .50i
51.nr FM .25i
52.nr PO 0
53.po 0
54.nr LL 3.5i
55.ll 3.5i
56.de nc
57.bp
58..
59.de h
60.LG
61.B
62\\$1
63.R
64.NL
65..
66.LG
67.LG
68.B
69.ce
70Ex Quick Reference
71.R
72.NL
73.LP
74.LP
75.h "Entering/leaving ex"
76.TS
77aw(1.4i)b aw(1.8i).
78% ex \fIname\fP edit \fIname\fP, start at end
79% ex +\fIn\fP \fIname\fP ... at line \fIn\fP
80% ex \-t \fItag\fP start at \fItag\fP
81% ex \-r list saved files
82% ex \-r \fIname\fP recover file \fIname\fP
83% ex \fIname\fP ... edit first; rest via \fB:n\fP
84% ex \-R \fIname\fP read only mode
85: x exit, saving changes
86: q! exit, discarding changes
87.TE
88.h "Ex states"
89.TS
90lw(1i) lw(2.0i).
91Command T{
92Normal and initial state. Input prompted for by \fB:\fP.
93Your kill character cancels partial command.
94T}
95Insert T{
96Entered by \fBa\fP \fBi\fP and \fBc\fP.
97Arbitrary text then terminates with line having only \fB.\fP
98character on it or abnormally with interrupt.
99T}
100Open/visual T{
101Entered by \fBopen\fP or \fBvi\fP, terminates with \fBQ\fP
102or ^\e.
103T}
104.TE
105.h "Ex commands"
106.TS
107lw(.45i) lw(.08i)b lw(.45i) lw(.08i)b lw(.45i) lw(.08i)b.
108abbrev ab next n unabbrev una
109append a number nu undo u
110args ar open o unmap unm
111change c preserve pre version ve
112copy co print p visual vi
113delete d put pu write w
114edit e quit q xit x
115file f read re yank ya
116global g recover rec \fIwindow\fP z
117insert i rewind rew \fIescape\fP !
118join j set se \fIlshift\fP <
119list l shell sh \fIprint next\fP \fRCR\fP
120map source so \fIresubst\fP &
121mark ma stop st \fIrshift\fP >
122move m substitute s \fIscroll\fP ^D
123.TE
124.h "Ex command addresses"
125.TS
126lw(.3i)b lw(0.8i) lw(.3i)b lw(0.8i).
127\fIn\fP line \fIn\fP /\fIpat\fP next with \fIpat\fP
128\&. current ?\fIpat\fP previous with \fIpat\fP
129$ last \fIx\fP-\fIn\fP \fIn\fP before \fIx\fP
130+ next \fIx\fP,\fIy\fP \fIx\fP through \fIy\fP
131\- previous \(aa\fIx\fP marked with \fIx\fP
132+\fIn\fP \fIn\fP forward \(aa\(aa previous context
133% 1,$
134.TE
135.nc
136.h "Specifying terminal type"
137.TS
138aw(1.7i)b aw(1.5i).
139% setenv TERM \fItype\fP \fIcsh\fP and all version 6
140$ TERM=\fItype\fP; export TERM \fIsh\fP in Version 7
141See also \fItset\fR(1)
142.TE
143.h "Some terminal types"
144.TS
145lw(.4i) lw(.4i) lw(.4i) lw(.4i) lw(.4i).
1462621 43 adm31 dw1 h19
1472645 733 adm3a dw2 i100
148300s 745 c100 gt40 mime
14933 act4 dm1520 gt42 owl
15037 act5 dm2500 h1500 t1061
1514014 adm3 dm3025 h1510 vt52
152.TE
153.h "Initializing options"
154.TS
155lw(.9i)b aw(1.5i).
156EXINIT place \fBset\fP's here in environment var.
157set \fIx\fP enable option
158set no\fIx\fP disable option
159set \fIx\fP=\fIval\fP give value \fIval\fP
160set show changed options
161set all show all options
162set \fIx\fP? show value of option \fIx\fP
163.TE
164.h "Useful options"
165.TS
166lw(.9i)b lw(.3i) lw(1.0i).
167autoindent ai supply indent
168autowrite aw write before changing files
169ignorecase ic in scanning
170lisp \fB( ) { }\fP are s-exp's
171list print ^I for tab, $ at end
172magic \fB. [ *\fP special in patterns
173number nu number lines
174paragraphs para macro names which start ...
175redraw simulate smart terminal
176scroll command mode lines
177sections sect macro names ...
178shiftwidth sw for \fB< >\fP, and input \fB^D\fP
179showmatch sm to \fB)\fP and \fB}\fP as typed
180slowopen slow choke updates during insert
181window visual mode lines
182wrapscan ws around end of buffer?
183wrapmargin wm automatic line splitting
184.TE
185.LP
186.h "Scanning pattern formation"
187.TS
188aw(.9i)b aw(1.0i).
189\(ua beginning of line
190$ end of line
191\fB.\fR any character
192\e< beginning of word
193\e> end of word
194[\fIstr\fP] any char in \fIstr\fP
195[\(ua\fIstr\fP] ... not in \fIstr\fP
196[\fIx\-y\fP] ... between \fIx\fP and \fIy\fP
197* any number of preceding
198.TE
199.nc
200.LP
201.LG
202.LG
203.B
204.ce
205Vi Quick Reference
206.NL
207.R
208.LP
209.LP
210.h "Entering/leaving vi"
211.TS
212aw(1.4i)b aw(1.8i).
213% vi \fIname\fP edit \fIname\fP at top
214% vi +\fIn\fP \fIname\fP ... at line \fIn\fP
215% vi + \fIname\fP ... at end
216% vi \-r list saved files
217% vi \-r \fIname\fP recover file \fIname\fP
218% vi \fIname\fP ... edit first; rest via \fB:n\fP
219% vi \-t \fItag\fP start at \fItag\fP
220% vi +/\fIpat\fP \fIname\fP search for \fIpat\fP
221% view \fIname\fP read only mode
222ZZ exit from vi, saving changes
223^Z stop vi for later resumption
224.TE
225.h "The display"
226.TS
227lw(.75i) lw(2.2i).
228Last line T{
229Error messages, echoing input to \fB: / ?\fP and \fB!\fR,
230feedback about i/o and large changes.
231T}
232@ lines On screen only, not in file.
233~ lines Lines past end of file.
234^\fIx\fP Control characters, ^? is delete.
235tabs Expand to spaces, cursor at last.
236.TE
237.LP
238.h "Vi states"
239.TS
240lw(.75i) lw(2.2i).
241Command T{
242Normal and initial state. Others return here.
243ESC (escape) cancels partial command.
244T}
245Insert T{
246Entered by \fBa i A I o O c C s S\fP \fBR\fP.
247Arbitrary text then terminates with ESC character,
248or abnormally with interrupt.
249T}
250Last line T{
251Reading input for \fB: / ?\fP or \fB!\fP; terminate
252with ESC or CR to execute, interrupt to cancel.
253T}
254.TE
255.h "Counts before vi commands"
256.TS
257lw(1.5i) lw(1.7i)b.
258line/column number z G |
259scroll amount ^D ^U
260replicate insert a i A I
261repeat effect \fRmost rest\fP
262.TE
263.h "Simple commands"
264.TS
265lw(1.5i)b lw(1.7i).
266dw delete a word
267de ... leaving punctuation
268dd delete a line
2693dd ... 3 lines
270i\fItext\fP\fRESC\fP insert text \fIabc\fP
271cw\fInew\fP\fRESC\fP change word to \fInew\fP
272ea\fIs\fP\fRESC\fP pluralize word
273xp transpose characters
274.TE
275.nc
276.h "Interrupting, cancelling"
277.TS
278aw(0.75i)b aw(1.6i).
279ESC end insert or incomplete cmd
280^? (delete or rubout) interrupts
281^L reprint screen if \fB^?\fR scrambles it
282.TE
283.h "File manipulation"
284.TS
285aw(0.75i)b aw(1.6i).
286:w write back changes
287:wq write and quit
288:q quit
289:q! quit, discard changes
290:e \fIname\fP edit file \fIname\fP
291:e! reedit, discard changes
292:e + \fIname\fP edit, starting at end
293:e +\fIn\fR edit starting at line \fIn\fR
294:e # edit alternate file
295^\(ua synonym for \fB:e #\fP
296:w \fIname\fP write file \fIname\fP
297:w! \fIname\fP overwrite file \fIname\fP
298:sh run shell, then return
299:!\fIcmd\fP run \fIcmd\fR, then return
300:n edit next file in arglist
301:n \fIargs\fP specify new arglist
302:f show current file and line
303^G synonym for \fB:f\fP
304:ta \fItag\fP to tag file entry \fItag\fP
305^] \fB:ta\fP, following word is \fItag\fP
306.TE
307.h "Positioning within file"
308.TS
309aw(0.75i)b aw(1.6i).
310^F forward screenfull
311^B backward screenfull
312^D scroll down half screen
313^U scroll up half screen
314G goto line (end default)
315/\fIpat\fR next line matching \fIpat\fR
316?\fIpat\fR prev line matching \fIpat\fR
317n repeat last \fB/\fR or \fB?\fR
318N reverse last \fB/\fR or \fB?\fR
319/\fIpat\fP/+\fIn\fP n'th line after \fIpat\fR
320?\fIpat\fP?\-\fIn\fP n'th line before \fIpat\fR
321]] next section/function
322[[ previous section/function
323% find matching \fB( ) {\fP or \fB}\fP
324.TE
325.h "Adjusting the screen"
326.TS
327aw(0.75i)b aw(1.6i).
328^L clear and redraw
329^R retype, eliminate @ lines
330z\fRCR\fP redraw, current at window top
331z\- ... at bottom
332z\|. ... at center
333/\fIpat\fP/z\- \fIpat\fP line at bottom
334z\fIn\fP\|. use \fIn\fP line window
335^E scroll window down 1 line
336^Y scroll window up 1 line
337.TE
338.nc
339.h "Marking and returning
340.TS
341aw(0.5i)b aw(2.0i).
342\(ga\(ga previous context
343\(aa\(aa ... at first non-white in line
344m\fIx\fP mark position with letter \fIx\fP
345\(ga\fIx\fP to mark \fIx\fP
346\(aa\fIx\fP ... at first non-white in line
347.TE
348.h "Line positioning"
349.TS
350aw(0.5i)b aw(2.0i).
351H home window line
352L last window line
353M middle window line
354+ next line, at first non-white
355\- previous line, at first non-white
356\fRCR\fP return, same as +
357\(da \fRor\fP j next line, same column
358\(ua \fRor\fP k previous line, same column
359.TE
360.h "Character positioning"
361.TS
362aw(0.5i)b aw(2.0i).
363\(ua first non white
3640 beginning of line
365$ end of line
366h \fRor\fP \(-> forward
367l \fRor\fP \(<- backwards
368^H same as \fB\(<-\fP
369\fRspace\fP same as \fB\(->\fP
370f\fIx\fP find \fIx\fP forward
371F\fIx\fP \fBf\fR backward
372t\fIx\fP upto \fIx\fP forward
373T\fIx\fP back upto \fIx\fP
374; repeat last \fBf F t\fP or \fBT\fP
375, inverse of \fB;\fP
376| to specified column
377% find matching \fB( { )\fP or \fB}\fR
378.TE
379.h "Words, sentences, paragraphs"
380.TS
381aw(0.5i)b aw(2.0i).
382w word forward
383b back word
384e end of word
385) to next sentence
386} to next paragraph
387( back sentence
388{ back paragraph
389W blank delimited word
390B back \fBW\fP
391E to end of \fBW\fP
392.TE
393.h "Commands for \s-2LISP\s0"
394.TS
395aw(0.5i)b aw(2.0i).
396) Forward s-expression
397} ... but don't stop at atoms
398( Back s-expression
399{ ... but don't stop at atoms
400.TE
401.nc
402.h "Corrections during insert"
403.TS
404aw(.5i)b aw(2.0i).
405^H erase last character
406^W erases last word
407\fRerase\fP your erase, same as \fB^H\fP
408\fRkill\fP your kill, erase input this line
409\e escapes \fB^H\fR, your erase and kill
410\fRESC\fP ends insertion, back to command
411^? interrupt, terminates insert
412^D backtab over \fIautoindent\fP
413\(ua^D kill \fIautoindent\fP, save for next
4140^D ... but at margin next also
415^V quote non-printing character
416.TE
417.h "Insert and replace"
418.TS
419aw(.5i)b aw(2.0i).
420a append after cursor
421i insert before
422A append at end of line
423I insert before first non-blank
424o open line below
425O open above
426r\fIx\fP replace single char with \fIx\fP
427R replace characters
428.TE
429.h "Operators (double to affect lines)"
430.TS
431aw(0.5i)b aw(2.0i).
432d delete
433c change
434< left shift
435> right shift
436! filter through command
78ed81a3 437\&= indent for \s-2LISP\s0
15637ed4
RG
438y yank lines to buffer
439.TE
440.h "Miscellaneous operations"
441.TS
442aw(0.5i)b aw(2.0i).
443C change rest of line
444D delete rest of line
445s substitute chars
446S substitute lines
447J join lines
448x delete characters
449X ... before cursor
450Y yank lines
451.TE
452.h "Yank and put"
453.TS
454aw(0.5i)b aw(2.0i).
455p put back lines
456P put before
457"\fIx\fPp put from buffer \fIx\fP
458"\fIx\fPy yank to buffer \fIx\fP
459"\fIx\fPd delete into buffer \fIx\fP
460.TE
461.h "Undo, redo, retrieve"
462.TS
463aw(0.5i)b aw(2.0i).
464u undo last change
465U restore current line
466\fB.\fP repeat last change
467"\fId\fP\|p retrieve \fId\fP'th last delete
468.TE