topics that matter; ideas worth sharing

share a tip, submit a link, add something new

vi vs. Emacs

October 17, 2001, 05:17 PM —  Unix Insider — 

It took a little longer to prepare for this
month's column:

Nomex suit? ...Check!

Kevlar vest? ...Check!

Elbow pads? ...Check!

Helmet? ...Check!

Ready? ...Ready!

OK. Here is the entire column, in a nutshell:

Emacs rules.

vi drools.

Right about now, all the Emacs users are surfing off to other parts of
the magazine, wondering why I'm restating the obvious. All the vi users
are angrily sending e-mail that reads something like this:

     You are a blithering idiot!  Emacs is the worst editor ever
     invented!  I learned vi and I've never needed anything else!
     :wq!
     ^[kdd:w!q!ZZ
     ^C^D.exit
     quit
     logout

The rest of you are probably wondering what on Earth I'm talking about.

Back to basics

When developing software, the most important tool at your disposal is
your text editor. It must be robust, extensible, easily learned, and
productive. You will probably spend more time using your text editor
than any other tool. It should fit like a glove and be as comfortable
as an old shoe.

Within the world of Unix software development, there are two principal
choices for editors: Emacs and vi. Invariably, the people who choose
Emacs loathe vi, and those who choose vi are appalled by Emacs. In case
you hadn't figured it out by now, I'm in the former camp. In spite of
my obvious bias, I'll still try to give a brief overview of each tool,
expanding on the virtues and drawbacks of each.

Emacs: the tool of tools

Emacs is a freely available editor originally written by Richard
Stallman and since enhanced by thousands of enterprising contributors.
It is distributed by the Free Software Foundation and is available in
both source code and precompiled forms. (You can ftp a copy from the
/pub/gnu directory at prep.ai.mit.edu or one of numerous mirror ftp
sites. ) It supports both
character-based and X Window environments and runs under a wide variety
of operating systems, including Unix, DOS, and Windows.

Emacs has been written by programmers for programmers. Its single best
feature is that it is infinitely extensible by means of a built-in LISP
interpreter. Almost every command in Emacs is actually a tiny little
LISP program that acts upon your text files. To extend Emacs, you
simply modify the existing programs or add a few of your own.

Emacs is known as a "modeless" editor, meaning that it is always ready to
both accept text as input and act upon that text via user commands.
You never switch between "command" and "input" modes in Emacs.




In Emacs, modes exist for just about

every conceivable programming language

-- even languages like HTML.



New users are sometimes confused by the fact that Emacs does have
various operating modes that determine how text in a particular buffer
will be handled. For example, Emacs has a "C" mode that understands how
C programs are formatted. As you type your source code, Emacs
automatically indents and formats your code. In the X version, it will
even render function names and other language elements in

I like it!
Post a comment
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
Resources
White Paper

Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.

Webcast

Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.

White Paper

Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.

Free stuff
Featured Sponsor

Get a broad understanding of important regulations and how you can make sure your site is in adherence.





Learn how VeriSign SGC-enabled SSL Certificates can help improve site security and customer confidence in the free white paper, "How to Offer the Strongest SSL Encryption." In this paper you will learn the differences between weak and strong encryption and what they mean for your site's performance.

Get VeriSign's free white paper: "The Latest Advancements in SSL Technology" and learn about the benefits of strong SSL encryption, Extended Validation (EV) SSL and security trust marks and what these SSL offerings can do for your site.

Now with Extended Validation (EV) SSL available from VeriSign, you can show your customers that they can trust your site. Learn about EV SSL benefits in this free VeriSign white paper.

More Resources