[geeks] vi vs. emacs - rational discussion

David L Kindred (Dave) d.kindred at telesciences.com
Mon Apr 5 09:48:56 CDT 2004


>>>>> "Bill" == Bill Bradford <mrbill at mrbill.net> writes:

    Bill> I learned vi when I first touched a unix box.  I now use VIM,
    Bill> solely for color syntax highlighting.

    Bill> Why (if any reasons), should I consider learning Emacs?

Actually they are different beasts.  Comparing vi to emacs is akin to
comparing apples to supermarkets.

Whereas vi is pretty much just an editor, emacs is a complete
environment.  For software development I believe the way emacs couples
with the compilers, assemblers, debuggers, and other tools is in direct
competition to any of the high-priced Integrated Development
Environments (IDEs) on the market.

When you add in all of the other tools emacs has available you can end
up never needing to leave that environment.

I'll grant that integration was more important in the days before
near-universal desktop windowing systems, but for many tasks the ability
to stay within the same environment is nice.  I find the ability to stay
keyboard-centric rather than mouse-centric much more productive.  Others
find the opposite to be true, and you can drive emacs either way.

Emacs also has the advantage of being the same, and has been the same,
on many platforms for many years.  As other systems and their "native"
editors come and go, emacs stays.  Here we argue "emacs vs vi", but the
arguments have been the same for decades.  I first learned emacs on a
DEC-20, and there the argument was "emacs vs tvedit".  Same argument,
different competing editor.

I am not one of those people who would state that only one of these
should exist.  Simpler editors like vi do have advantages, especially
when making short edits on one file, particularly due to their short
startup.  But there are some incredible things that can be done inside
of emacs that would take extensive scripting with the standard Unix
tools.  Keyboard macros alone have saved me countless hours of work.

There are other features too.  Like emacs will edit virtually any file,
including "binary" files (either as a string of bytes or in hex-editor
mode).  It can handle DOS style line formatting when that's important
for data interchange.  And who can resist a graphical "towers of hanoi"
solution :)

To try and answer your question, if you are thinking of working on a big
software project and don't have an IDE for the language(s) used in that
project, then I would recommend learning emacs and take advantage of
interaction with the other tools (if you've never seen it done, use "M-X
compile" to run make in the current directory, then when the compilation
finishes "C-X `" jumps right to the source file location of the first
error).  Check out the cool things you can do with tags ("M-x
tags-query-replace" is one of my favorites).  And as good as gdb is by
itself, it's even better inside of emacs with the matching source
window.

If you've already got an IDE, or if you're just doing small projects and
are comfortable working the way are (especially if you're using the X
tools that also add features to the command line tools), then learning
emacs may not be worth the trouble.

As a final point, you'd also be surprised to find how many other
programs recognize basic emacs-style motion commands!

-- 
David L. Kindred
Unix Systems & Network Administrator
Telesciences, Inc.



More information about the geeks mailing list