UC Irvine, Information and Computer Science Department Winter 2000

ICS 54: Brief Notes on Chapter 10: Text Editing with vi


Selected References

The text's coverage is a very, very good place to start, but, inevitably, it will not be enough.
http://docs.FreeBSD.org/44doc/usd/12.vi/paper.html
Bill Joy's An Introduction to Display Editing with Vi
The original tutorial. Hard to say that this isn't still the best.
http://ecn.www.ecn.purdue.edu/ECN/Documents/VI/
VI Tutorial from Purdue -- Neither too little nor much too much.
http://www.oac.uci.edu/help/manuals/uci.unix.guide/the_vi_editor.html
The vi portion of the UCI UNIX User Guide.
http://www.rru.com/~meo/useful/vi/vi.rm.html
A (too?) short reference manual.
http://www.ungerhu.com/jxh/vi.html
A (too?) long reference manual.
http://www.cis.udel.edu/~totten/vi/
A (maybe just right) mid-size, mid-depth reference manual.
http://www.math.fu-berlin.de/~guckes/vi/
The VI Page -- More than you ever need.
http://www.thomer.com/thomer/vi/vi.html
vi lovers home page -- Only slightly less encyclopaedic


Some Useful (Combinations of) Commands

Beware: vi is case sensitive!

3dd
Delete 3 lines
d3w
Delete 3 Words
d3}
Delete the rest of this paragraph and the next 2.
.
Repeat last command.
u
Undo last command. Note: uu leaves file unchanged.
yyp
Duplicate this line.
ddp
Transpose this line and the next.
xp
Transpose this letter and the next.
:g/^Hello/d
Delete any line beginning with Hello.
:v/^Hello/d
Delete any line not beginning with Hello.
:g/^Hello/s//HELLO/
Replace any Hello at the start of a line by HELLO
:.,.+4s=/=\=g
Replace all / by \ on this line and the next 4.
:g+^/+s+$+##+
Put ## at the end of any line which begins with /
:.!date
Replace this line by (the output of) the date command.
:.,$!spell
Replace the rest of this file by the words in it which spell says are not spelled correctly.
:w
Save all changes made thus far.
:wq
Exit saving changes.
:q!
Exit without saving changes.

Comments are welcome.
Current as of 22 January 2000
HTML 4.01 Checked.