[Sussex] Vi?
Geoffrey Teale
tealeg at member.fsf.org
Wed Jul 28 06:16:32 UTC 2004
Gavin,
You're right, the joy of vi is that you can make a simple change to a
file in a fraction of a second - sometimes you can fire off the keys so
quickly that vi is on the screen and off it again before you know it. I
use vi a lot in this context, and as many people have said, I use it on
debian boxes with no other editor present.
For these reasons it really is worth learning the basics of vi if you
are going to interract with legacy linux environments (and yes Debian is
a legacy linux environment *pulls on flame retardant suiit*). Almost
all distros now provide nano instead of vi (or in some cases as well as
vi) in their minimalist environment. Why? Well for a start it's
smaller than vi (damn that bloatware), it's also significantly more
intuitive than vi (in that it actually gives the user some indication of
what key they need to press to get out of it once it's open, and doesn't
need them to learn the concept of modes.
Emacs is, as everyone has been saying a bigger investment in terms on
memory, load time etc, however if you're doing any serious text editing
it is so much more powerful than vi that it is unbelievable.
In this regard I'd like to point out a few things about GNU Emacs:
- Like vi is doesn't require an X session, though unlike vi it can use
a GUI session to it's full effect without requiring you to run a
different version of the program.
- Unlike vi Emacs doesn't require you to mode switch all the time, the
price for this is that you usually have to press more than one key
together to achieve some effect, given that we have two hands (and Emacs
has accesability modes for those who don't), and that the commands can
be rebound to whatever keys you like this seems like less of a problem
to me than having to remember to switch modes all the time (remember,
just a single keypress in the wrong vi mode can be destructive).
- vi requires you to learn it's key combos right out of the box. Emacs
provides menu's to simplify the environment for new users. In a first
session it is very easy for a new user to find the tutorial that
explains all of the basic key combos you can use. Noteably my wife
couldn't succesfully edit an HTML file in vim without massive amounts of
assistance from me, but she worked happily for many days in Emacs. She
wasn't using it to it's full capacity by any means, but she was getting
the job done.
- Because Emacs is a prgoammable environment (and many people have
created hundreds of tools in Emacs) you can use it to edit just about
anything - you can even use it as an e-mail client or an irc client.
This means that all the powerful editing techniques you develop will be
equally applicable in those environments. Vi can be plugged into some
mail clients (e.g. mutt) as well, but this is a less natural
attachment. Moreover Emacs can do things like displaying inline images
and playing media files, which man people require in this context. The
point is, you only need to learn the core set of editing commmands once,
and then a few new commands for each tool you use - all the power is
available to you all the time and you expend far less mental effort
learning each new tool.
- Emacs also includes seemless integration with most source control
mechanisms. It allows you to simply manage the source in your project
and provides powerful diffing and conflict resolution tools - all in the
same environment that you edit in - this saves a considerable amount of
systems resouce, time and intellectual effort.
- Emacs doesn't need to be running on the remote machine when you want
to edit files elsewhere. So long as you have ssh access to a machine
you can open a file for editing locally via tramp mode. Tramp mode can
also tunnel over ftp, http, webdav, su and sudo (the last two are
obviously local).
... there more left to say, but I'm running out of time. vi is for
small Sysadmin tasks, Emacs is for manly programming task ;)
--
Geoff
More information about the Sussex
mailing list