E.2. Amaze Your Friends!
In the long term,
perhaps the most useful items are in the
collection of vi related information
in the alf.uib.no ftp archives.
The original archives are at
ftp://afl.uib.no/pub/vi.
We had little success with this site, however the archives are
mirrored at
ftp://ftp.uu.net/pub/text-processing/vi.
The file INDEX in that directory describes what's
in the archives, and lists additional mirrors that may be
geographically closer to you.
Unfortunately, these files were last updated in
May of 1995. Fortunately, vi's basic
functionality has not changed, and the information and macros
in the archive are still useful.
The archive has four subdirectories:
- docs
- Documentation on vi, also some comp.editors postings.
- macros
- vi macros.
- comp.editors
- Various materials posted to comp.editors.
- programs
- Source code for vi clones for
various platforms (and other programs).
Take things from here with caution, as much of it is out of date.
The docs and macros are
the most interesting.
The docs directory has a large number
of articles and references, ranging from beginner's guides,
explanations of bugs, quick references, and many
short "how to" kinds of articles (e.g., how to
capitalize just the first letter of a sentence
in vi).
There's even a song about vi!
The macros directory has over 50 files in it
that do different things. We mention just three of them.
(Files whose names end in .Z are compressed with
the UNIX compress program. They can be uncompressed
with either uncompress or gunzip.)
- evi.tar.Z
- An emacs "emulator."
The idea behind it is to turn vi into a
modeless editor (one that is always in input mode, with commands
done with control keys).
It is actually done with a shell script that replaces the
EXINIT environment variable.
- hanoi.Z
- This is perhaps the most famous of the unusual uses of vi;
a set of macros that solve the Towers of Hanoi programming problem.
This program simply displays the moves, it does not actually
draw the disks. For fun, we have reprinted it in the sidebar.
- turing.tar.Z
- This program uses vi to implement an actual
Turing machine!
It's rather amazing to watch it execute the programs.
There are many, many more interesting macros, including
Perl and RCS modes and even a Word Star emulator.
The Towers of Hanoi, vi Version
" From: gregm@otc.otca.oz.au (Greg McFarlane)
" Newsgroups: comp.sources.d,alt.sources,comp.editors
" Subject: VI SOLVES HANOI
" Date: 19 Feb 91 01:32:14 GMT
"
" Submitted-by: gregm@otc.otca.oz.au
" Archive-name: hanoi.vi.macros/part01
"
" Everyone seems to be writing stupid Tower of Hanoi programs.
" Well, here is the stupidest of them all: the hanoi solving
" vi macros.
"
" Save this article, unshar it, and run uudecode on
" hanoi.vi.macros.uu. This will give you the macro file
" hanoi.vi.macros.
" Then run vi (with no file: just type "vi") and type:
" :so hanoi.vi.macros
" g
" and watch it go.
"
" The default height of the tower is 7 but can be easily changed
" by editing the macro file.
"
" The disks aren't actually shown in this version, only numbers
" representing each disk, but I believe it is possible to write
" some macros to show the disks moving about as well. Any takers?
"
" (For maze solving macros, see alt.sources or comp.editors)
"
" Greg
"
" ------------ REAL FILE STARTS HERE ---------------
set remap
set noterse
set wrapscan
" to set the height of the tower, change the digit in the following
" two lines to the height you want (select from 1 to 9)
map t 7
map! t 7
map L 1G/t^MX/^0^M$P1GJ$An$BGC0e$X0E0F$X/T^M@f^M@h^M$A1GJ@f0l$Xn$PU
map g IL
map I KMYNOQNOSkRTV
map J /^0[^t]*$^M
map X x
map P p
map U L
map A
map B "hyl
map C "fp
map e "fy2l
map E "hp
map F "hy2l
map K 1Go^[
map M dG
map N yy
map O p
map q tllD
map Y o0123456789Z^[0q
map Q 0iT^[
map R $rn
map S $r$
map T ko0^M0^M^M^[
map V Go/^[
|
| | | E. vi and the Internet | | E.3. Tastes Great, Less Filling |
Copyright © 2003 O'Reilly & Associates. All rights reserved.
|
|