Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ABOI (h): Hack vi Tutorial [Dave Packer]

0 views
Skip to first unread message

Maldenkarl

unread,
Jul 24, 1996, 3:00:00 AM7/24/96
to

From: dpa...@scunix4.harvard.edu (David Packer)
Newsgroups: alt.fan.karl-malden.nose
Subject: Hack vi Tutorial
Date: 7 Dec 1995 18:30:26 GMT
Organization: Legion of Ungodly Problem Sets

There are only a few simple rules one must follow in order
overcome the debilitating condition that is vi. I'm not claiming that
one can totally overcome their disability, but at least it is possible
to become a productive member of the Malden society.

First off, I would like to address the issue of people telling
other people to change their default editors. Specifically, I would like
to say: STOP IT. Yer making us feel like losers. Or at least, well, me.
At the beginning of the semester, someone told me I could be cured
simply by changing a few lines in my .login, or .dot cshrc, or .tinrc,
or whatever. I tried this, and was immensely frustrated by my failure
to produce tangible results. Near as I can tell, immediately after the
procedure, I was able to post once (and only once) using God's own text
editor, pico.

Why is vi so frustrating? Good question! Vi is frustrating
because it was written by _programmers_. Programmers are the people who
teach classes like CS50. Their goal is to propogate the degenerate
species; the first step along the hell - path that is programmerdom is
vi fluency. DON'T LET YOURSELF BECOME PROFICIENT IN VI. You will regret
it in the morning. There is some knowledge that is not meant for the
human mind to know.

A HACK VI TUTORIAL:

There is one very very important thing one must realize before
even attempting to use vi: there are two "modes." Don't ask why. "Why"
is the question the programmers want you to ask; don't give in to the
temptation.
Mode one: command mode. You can always get to command mode by
hitting escape five or six times. If you are very confused, hitting
escape more helps. vi starts off in command mode, but it is a good idea
to hit escape maybe twelve times at the start of a session, just to be
sure. The first thing one should do (after hitting escape) upon entering
vi
is to type the following command: ":set wrapmargin=8" Notes: do
not type the quotation marks. is the "return" key on the
keyboard. If you forget this command, your text will look fine to you,
but it will in fact be "wrapped." "Wrapped" text is yet another
contrivance of the programmers; it is the essence of their perversion.
If you "wrap" text on a post, people will make fun of you. This is
generally considered bad.

There are only two other commands one need be familiar with in
order to have good "hack vi" style: these are the "x" key and the double
- keystroke "dd". The "x" key deletes one (1) character, the command
"dd" deletes a whole line. Note that there is no "hack" method of
undeleting, so be very careful what you erase. Particularly advanced
hackers may want to experiment with prefacing these commands with
numbers. These numbers control the number of lines / characters to be
deleted.

You now know enough to start writing in vi. Enough, that is, if
you knew how to make the program accept text, which it won't unless you
hit "i" in command mode. "i" stands for "insert." This is the only thing
in vi which is internally consistent; thus I do not consider it a
corruption of good morality to share this tidbit with you. If, in the
course of typing, you make a mistake, just hit "" (to get into
command mode), and then use the arrow keys to find your mistake, "x" or
"dd" to fix it, type "i" if it is necessary to insert text, and then you
can use the arrow keys to go back to what you were working on (the arrow
keys work in both insert and command mode). It is not always necessary
to delete the text after a mistake. If you allow it to pile up as you
type, the result can be very aesthetically pleasing. Here, for example,
is a complete index of all the typos I have made while typing this:

necessary ukeioeOart abieoinerrne
ye iem. eelnfeOs a/otrthyter n,diiaiRi

This language seems loosely related to Welsh, though linguists
have yet to come to a satisfactory conclusion on this.

A warning about the arrow keys: sometimes they get kind of
touchy. If you are trying to go a long way using the arrow keys,
sometimes the computer beeps and starts spewing nonsense. This is called
a "bug." Programmers add them after they complete programs, in order to
try to force hackers to act more like programmers. Be patient, and don't
give in to those "other" commands which purport to move you around in
the text block. Just fix the damage done by the bug, and go carefully
about your way.

Once you have finished editing your text, how do you save it?
How do you get out of vi? You are correct in supposing that it has
something to do with command mode. The following commands all do
something very important to your text:

:w
:wq
:q
:q!

":w" is "write." This saves your file, but does not exit the
program. ":wq" writes _and_ quits. If you donot want to write the text,
but would like to quit anyway (as often happens), type ":q!". This is
the "override" command, and leaves the program immediately, without
saving. "q" stands for "quit," and only works if you have not edited the
text (else it gives some error message like "not write since last
dadage, would you like fries with that? q! overrides.").

This is all you need to know to lead a happy and productive vi
life. Good luck. I salute you, brave hack-vi-ers.

--dave. This text written completely with hack
vi.

ed sn~!w yit


0 new messages