[aklug] the power of vim (was: Re: Slackware says "I told you so!")

From: Royce Williams <royce@tycho.org>
Date: Sun Feb 27 2011 - 21:44:44 AKST

Christopher Howard said, on 02/27/2011 08:13 PM:
>> :-) You also seem to misunderstand my vi(m) jab. Yes, it is my personal
>> choice, but spurring on a decades old debate which has long devolved into
>> silliness is done more for good natured entertainment than rabid dogmatism.

> Here, you conveniently define "raw functionality" to fit only within the
> confines of your concerns. "Resource utilization". "Number of keystrokes
> for mass edits". "Universal availability".

[lots of other good points snipped]

I think that it's important for somebody to stand up and actually speak
to the specific benefits of vi/vim, rather than just hand-waving. ;-)

The day that I learned that I could say "indent this code paragraph
twice in a way that's aware of the current indenting context" or
"replace 'foo' with 'bar', but only in the next 10 lines" or "delete
until the next right curly brace" ... all with just a few keystrokes ...
is the day that vi/vim had me.

You know how you can be looking over someone's shoulder and they're
painstakingly scrolling sloooowly down the screen to get to the bottom
of their loooong browser window or Word or whatever? And how you know
that there's a keystroke to do that, and you have a meeting to go to,
but they're "used to" the way that they do things, so you have to sit
there and watch the scrolling, and your eyes just about bug out of your
head?

And then they accidentally click just outside the scrollbar range and
bring some other window forward, and it's bigger than the previous
window, and so they have to go up to the control bar to minimize the big
window so they can get back to their original window, because they've
never heard of Alt-Tab?

Or you know how you go home to visit your folks and they have a DVR but
don't know how to use the "skip ahead 30 seconds" button, and you
actually have to sit and squirm through the commercials, until you snap
and grab the remote out of their hands?

Watching people do stuff in editors other than vi/vim is like that.

With vim, without thought, I can:

* express an exact range to be moved, deleted, transformed to
all-upper-case, or process by an external script -- all with far more
precision and speed than I ever could with a mouse;

* instantly scroll the screen up or down just a couple of lines, while
leaving my cursor exactly where it is (for example, so that I can very
quickly expose the edges of a function that I'm editing);

* use built-in word completion -- based on all of the words and
variables used within the current document;

* see syntax-aware highlighting that also highlights bad syntax on the
fly so that bad code stands out like a sore thumb;

* pop open two or more views of exactly the same document, such that I
can see two different sections of it at once, editing either section
simultaneously;

* view a list of commands I've executed and select one for re-execution,
just like shell history;

* mark a specific area of the document with its own unique name, so that
I can instantly jump back to it whenever I want (which is killer for
working on code!);

* express something like, "OK, I'm going to start typing now, and I want
all characters between here and the next double-quote to be replaced,
and when you get to the double-quote, just start shoving it along until
I'm done typing";

* use regular expressions to search and replace text, including using
the matched text in the the replacement text;

* spawn an external command, passing X lines or a paragraph to it for
processing, returning the resulting text, and replacing the old text
with the new.

* record a series of commands and keystrokes and assign them to a
function key so that you can execute them with a single keystroke.

Oh, and did I mention that I can do all of these things *without my
hands leaving the keyboard*, even when I'm on a 9600 baud serial console
at 3am during an unplanned outage?

If you occasionally pop open a config file to make a single change,
joe/nano/gedit/Notepad/Wordpad are fine. But if you spend any time
editing text on a regular basis, and you are not using an editor that
can do things like the above, then you are wasting metric tons of
valuable time. You're just vaguely shuffling around wads of text in the
dark.

The increased precision made possible by powerful editors mean not only
increased throughput, but more importantly, increased *flow*.

Like any new tool, for a while you are thinking about the tool instead
of thinking about your work. But soon, the tool disappears, and you are
just *cranking*. The creators of vi and vim have also worked very hard
to keep the "grammar" of the command structure consistent, such that
once you internalize few basics (in the Unix way), you can quickly
understand how to do new types of things, because they use the same
command "vocabulary" to express their target text range, etc. This also
goes a long way to make the editor vanish, leaving only you and your work.

And even if you could find an Uber Editor that did many of these things
on your platform ... given that this powerhouse is built into just about
every Unix-like on the planet, why not learn how to do them *everywhere*?

("Gee, Royce ... why don't you tell us how you *really* feel?") ;-)

Royce
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Feb 27 21:44:47 2011

This archive was generated by hypermail 2.1.8 : Sun Feb 27 2011 - 21:44:47 AKST