Rainy sill at
Thu Jun 14 00:54:15 CEST 2001

On Wed, 13 Jun 2001 11:28:55 GMT, Pilgrim <gwyoder at> wrote:
> Can someone tell me what "vi" is for a text editor to work with python?
> Where can I get this?

Here's the idea, in a nutshell:

In most other text editors, if you want to use some advanced command,
you have function keys (F1-F12), you have numpad, you have a bunch of
keys like insert/home/end... and, most importantly, you have ctrl and
alt keys. So, in Emacs for instance, to go to the next line you may
use cursor key (the downside is that it takes your hands from the
homerow) OR, preferably, ctrl-n (if I remember right). Other well
known mappings are ctrl-f to find something and End key to go the
the end of file, etc.

So far we haven't mentioned vi. There is one problem with the above
approach that it ventures to fix: the problem is that all these
mappings are either taking you off the homerow (which is bad because
for a touch-typist that is quite a slowdown) OR if you use alt- and
ctrl- mappings, you simply don't have that many of them (considering
also that your window manager will often use some of them for window

Here's how vi fixes that: you get a new mode where you can use all
keys a-z and A-Z for advanced commands and custom mappings. For
example, if you want to cut 3 lines, you hit 3dd, to paste them
you hit p and so on - hundreds of commands. But, of course, vi
has to be able to tell whether you want 3dd to appear in you text
file or whether you want to cut 3 lines - I'm using vim (a newer
more flexible clone of vi) and when I typed 3dd just now, they had
to appear in this post. That's why vi(m) has an extra mode for commands,
when I want it to take commands, I hit <esc> key and use all the commands
I need, then navigate to the next place where I want text to be
inserted and hit 'i' which is a command to enter 'insert' mode, the mode
that works almost exactly like any other editor.

There is a tradeoff here - normal editors are very easy to learn but not
as powerful, while vi(m) is harder to learn but also adds some powerful
tricks to your warchest once you do. If you type a lot (especially code),
trying vi may be extremely useful in the long run.

There's also an old and unsettled (and perhaps unsettable) argument of
vi vs. emacs - emacs is also a very advanced and powerful editor that
uses series of mappings like C-x C-c instead of having another mode
for commands. It's probably more a matter of taste than anything else -
some people can't stand modal interface at all. Here's a short comparison

emacs - written in elisp, fairly large(28.1mb uncompressed debian package),
uses lisp as scripting language, includes many additional functionality
like news reading, web browser, mail client, etc etc

vim - written in c, lightweight(700kb), uses custom macro language, can use python
as scripting languages, does not include any extra functionality but can
be 'plugged in' by external programs, for instance I use slrn for news and
mutt for mail, and both of them can be set up to use vim for editing text

My advice is to try both and see which you like most.

Lime and limpid green
a second scene
A fight between the blue
you once knew
        - Syd

More information about the Python-list mailing list