Tags:

Emacs or Vi or pico?
June 16, 2004 9:43 AM   Subscribe

Emacs or Vi ...or pico? Throw down, people. I'm moving myself to more command-line stuff, and I'm trying to pick an editor. For reference, most of the folks I know say Vi is evil.

append 'm's as necessary.
posted by leotrotsky to Computers & Internet (40 answers total) 1 user marked this as a favorite
 
Vi isn't evil, as long as you remember that you have to press 'a' (append) before you can write anything. I'm a fan of Vim (vi improved) and Gvim (graphical vi improved) myself, and find them especially nice for writing HTML or PHP. Run a mile from Emacs unless you're a C programmer -- apparently it's quite useful for that, but it's complete overkill for most other things.
posted by reklaw at 9:51 AM on June 16, 2004


well, it really depends on what you are doing. for quick editing, i find that pico (or nano) are fantastic and should be a default on every system out there. other than that, before i started using kate, i used vim, and before i used vim, i used emacs. i found that emacs just had way too much stuff that i never would need. vi is the same, but not to such an extreme. really though, no one is going to be able to tell you which is better, as the betterness of either one is based on the user's opinion. best way to get a good solid answer, is to google for tutorials on each and give both a test run. just remember that all the wacky keyboard shortcuts and such may seem weird at first, but once you use it for awhile, they will become second nature. like shifting a car or some such thing. the more you do it, the less you think about it.

bottom line: neither is better.
posted by chrisroberts at 9:52 AM on June 16, 2004


I started out an emacs user, and I still use it for writing code (mostly C++/Java). It's great for those purposes--I can edit a few files, then compile the project with a couple keystrokes, and step through any errors/warnings I encounter in the different files in the project, without leaving my editor.

However, I eventually learned the basics of vi also, and now I use vi all the time for editing config files and all the other small text files you encounter when working with Unix. It starts up almost instantly, and it doesn't create all the backup~ files that emacs does by default (useful for programming, kind of annoying for other files). But most important of all, I know that I can sit down at a clean install of just about any kind of Unix machine and use vi, whereas emacs/pico/nano may or may not be installed.
posted by hashashin at 10:02 AM on June 16, 2004


Emacs is optimized for features. You can fire up emacs at the beginning of your workday and never leave.

vi is optimized for speed. Once you get over the learning curve and get the program in your fingers, it's pretty amazing how fast you can get things done.

If you need the features or if you want a heavily-customized work environment, go with emacs. If you want to edit files quickly and don't mind putting in some time up front, go with vi (or one of the vi-like editors such as vim).

Also, if you find yourself working on a strange machine you're more likely to have access to vi than emacs, especially if lots of users shell in to said machine.
posted by amery at 10:02 AM on June 16, 2004


Vi has two modes. One that beeps and one that corrupts your files.

In all seriousness: Vi keybindings are inefficient and painful, but emacs startup time and memory footprint are a bitch. Use something that has emacs keybindings but isn't quite as big as emacs. My editor-with-emacs-keybindings of choice is JED, but there are other options out there.
posted by fvw at 10:03 AM on June 16, 2004


emacs is better.
posted by bshort at 10:04 AM on June 16, 2004


background: just set up my machine dual-boot to linux, and I'm now learning how to do stuff with the os. I program a little in C/C++, and sometimes in Java. I'm just getting a handle on gcc/g++ and I'm looking to learn how to code from a command line in a unix system, as I figure a full IDE is overkill for most of what I'm doing (basic neural network & genetic algorithms stuff)
posted by leotrotsky at 10:06 AM on June 16, 2004


pico, but I haven't had to write anything outside of matlab lately. Maybe a few custom rules for spamassassin. I wouldn't use it enough to invest the time into learning vi or emacs. I used pico when I first learned C in college and have stuck with it ever since.
posted by mbd1mbd1 at 10:12 AM on June 16, 2004


The people you know who say that vi is evil surely either a) think that emacs is even worse, or b) are hardcore emacs people.

I don't think even emacs people argue that emacs is easier to use. But then, if you haven't used a serious text editor before, both are hard to use.

If you just want to edit text files (i.e. you are a new linux user), you might want to use something like nano, which is more or less intuitive to someone who is used to, say, Word or Notepad. Or, at the very least, have it installed and available. I find that my interest in trying to remember the command keys on any text editor is inversely proportional to how stressed out I am about the problem that I'm actually trying to solve.
posted by bingo at 10:14 AM on June 16, 2004


To each their own. Me, I really hate emacs, love vi. I find vi to be much more intuitive in a way that emacs isn't. Vi seems to me to be a closer member of the family of things that includes ed, grep, sed, awk, and so on.

But that's just me. Try each, decide for yourself after a couple of weeks. You'll naturally gravitate to the one that's proving most useful for you.
posted by gimonca at 10:18 AM on June 16, 2004


I say use pico right off the bat for day to day stuff because it's easy as heck. In your spare time, learn at least the rudiments of vi because of what amery said: it's pretty likely any random machine you want to work on will have it. Plus, it's baffling to someone unfamiliar with command line editors so if you don't at least know "oh, I need to press the ESC kay before I can do freaking anything" you might wind up in it by accident [if your email program uses it, for example and you use shell-based email] and it's good to at least know how to get out.
posted by jessamyn at 10:20 AM on June 16, 2004


If I was in your shoes, I'd learn both. Use vi for small editing tasks (like config files), something slightly easier like vim or pico/nano for web programming and plain text and emacs for heavy-duty C programming. Some people are bigoted and try to use one for absolutely everything (vi-vs-emacs being one of the all-time flamewar classics), but really you should use the one most suited to what you're trying to achieve at the time. You might them suitable for different things than I do. I'd just ignore everyone's opinions here and go try them all out.
posted by reklaw at 10:29 AM on June 16, 2004


useful one page pdf of emacs commands here.
I'm a big emacs fan, but the comments about vi being everywhere are very true.
posted by Flat Feet Pete at 10:30 AM on June 16, 2004


The only useful vi command is :q!
posted by kindall at 10:31 AM on June 16, 2004


I'd agree with pico/nano for most basic editing, config files, etc.

Though I'd recommend learning the basics of vi anyway (which i really need to do) as many apps seem to default to that if you choose edit from within the program.

(If you're talking something more intensive, like programming, then yeah, pico/nano is outclassed by the others mentioned here)
posted by John Kenneth Fisher at 10:31 AM on June 16, 2004


I would never write anything from scratch in vi, but I use it constantly for quick edits. I love it.

Plus, it makes me feel all macho and unix-y.
posted by jpoulos at 10:39 AM on June 16, 2004


Nano. I only edit config files or web-based files, I don't need extra stuff.
posted by Hackworth at 10:39 AM on June 16, 2004


I've seen people do Real Work in both, so I don't think it'll be a problem either way. I use emacs. This is partly because I know lisp (which is essentially the scripting language emacs uses for, well, everything). Knowing lisp is not a pre-req though. vi is counterintuitive to me. Emacs is to some people also, I understand, but, at least at first blush you can start it up and start typing. The newest version sucks, in my opinion. I use 20.7 or 20.6 depending on where I am. Even in 20.7 or .6 you can open, save, spell check, print, etc using menus (and the menus also generally give the keybinding for that command) so you can at least DO stuff without knowing all the key bindings. Emacs comes with a pretty decent tutorial. It's in the help menu. I'd have a hard time switching now. I have hundreds to thousands of lines of lisp code that does all the stuff I need. Hell, I can hardly use oracle, gdb, tons of other shell-based tools without emacs any more.
posted by RustyBrooks at 10:40 AM on June 16, 2004


Many people think whichever one they know better, is better. They are wrong.

emacs has more features. vi is lighter, and more likely to be installed on any random unix box you happen to run across. I've used both, and tend to prefer vi, but that's just because I happened to learn it first. Both work just fine.

I have actually used variations on this question in job interviews. If the candidate just blurts out "vi is evil!" or "emacs sucks!" I'm a lot less likely to hire them than if they give some indication that they've at least tried both, and have a reason for their preference. Doesn't matter whether it's emacs vs vi, or perl vs PHP, or mac vs windows, or whatever -- I'd rather work with developers who have some curiosity about the alternatives, rather than fixating on whatever tools they happen to be most comfortable with.
posted by ook at 10:44 AM on June 16, 2004


Ah, the Great Editor Debate. Long may it rage.

Pico is simple and easy, and I wish it were more widespread. Hard-core admins always roll their eyes at me when I say that, but good god, if I'm just editing a couple lines in a stupid text file, I don't need a ton of functionality.

On systems without Pico, I tend to gravitate toward vi. I just don't 'get' emacs, but I wasn't weaned on it. I appreciate people who can work well in emacs, but the curve is too big for me to deal with.
posted by mkultra at 11:05 AM on June 16, 2004


Maybe I'm just spoiled by all my Mac OS experience, where you can launch any text editor, no matter how complex, and immediately perform at least basic editing tasks, but I found both vi and emacs impossibly difficult. I couldn't even figure out how to make vi quit, the first couple of times I accidentally stumbled into it, and the documentation for Emacs was practically incomprehensible - like trying to read Russian, or something; I could see that there were words there, but couldn't figure out how to pronounce them, much less divine their meaning. After a great deal of study, I did manage to get to the point - in either editor - where I could open a file, make simple changes that didn't involve inserting or removing lines, and quit again, but the process was so unbearably laborious that I swore them both off for good.

Pico, on the other hand, is simple, obvious, and functional. I used it exclusively during a nine or ten month Linux programming stint a few years ago and got along quite swimmingly. The line-wrapping algorithm got old, but I'd rather deal with extra linebreaks every now and then than try once again to comprehend vi or emacs.
posted by Mars Saxman at 11:16 AM on June 16, 2004


i use emacs, but like everyone else says, anything works, and you really need to know both emacs and vi because something is going to dump you into one of them, or something with similar keybindings, at some point.

i hope (for their sake) mars saxman is exaggerating a little.

googling for emacs key bindings or vi key bdings gets you various crib sheets.
posted by andrew cooke at 11:36 AM on June 16, 2004


I use and love both.

In the end, I probably use vim the most since I use it as a replacement for notepad when in Windows and as a config editor when I'm on my Linux box. I use emacs whenever I'm writing code that has an repl, e.g., python, ruby, lisp, etc.

Honestly, I think you'd need to use both to discover which one you like best. They both have their strengths and weaknesses. For example, emacs, in my mind, has better word completion, but vim kills emacs when it comes to navigating a file.

So, if you've got the time, try 'em both: you may end up keeping them both around.
posted by AmaAyeRrsOonN at 11:45 AM on June 16, 2004


Pico.
posted by abcde at 11:48 AM on June 16, 2004


vi is eVIl, VIle, and clearly written by the deVIl. Emacs IS worse, especially if you don't have a META key on your keyboard---the first terminal/computer I learned Emacs on had meta mapped to escape. That was confusing, to put it mildly. Of course, instruction consisted of vauge mutterings about man pages, too.

That said, learning both isn't that hard, but using either will make you long for a modern mouse-enabled, modeless, menu-driven editor.
posted by bonehead at 11:53 AM on June 16, 2004


I'm a Vim fan. While it'll let you use the arrow keys to move around the document, the 'classical' hjkl movement keys are the key to superfast editing. Before Vim, I'd get wrist pain from constantly bending my wrist so I could hit the arrow keys with my right hand. Now I don't have to move my hands at all, which is good from both an ergonomics and an efficiency perspective. The 'Esc' key, which vi and Vim use a LOT, is kind of far away, though, which negates some of the ergonomic benefits, but on laptops it's nice and close.

If you're going to be coding for 8+ hours at a stretch, Vim is a lifesaver. Otherwise, nano will do great, but you'll probably start cursing the lack of a quick way to move around the document. (For those that don't know, nano is a GPL reimplementation of pico with added hi-tech features like search and replace!)
posted by zsazsa at 11:54 AM on June 16, 2004


zsazsa: Don't use the escape key!
posted by AmaAyeRrsOonN at 12:02 PM on June 16, 2004


It used to be that vi was on every Unix box and emacs wasn't, but I don't think that's the case in the Linux/*BSD/OS X world unless it was specifcally not installed. Anyway. vi is indeed fast, but it's modal and you have to remember to put it into text entry mode when you want to type. When I want to make a quick change in a script file and don't want to wait, vi works fine. But for script development and anything more than a couple of characters, it's emacs, hands down. And you don't have to run it in its own X window, you can run it in fullscreen mode in an xterm. You lose the mouse capability, but all the keystroke combinations work just fine.
posted by tommasz at 12:26 PM on June 16, 2004


It really depends on what you're going to be doing.

Many people who use emacs start it once at the beginning of the day and never leave. It can be used as an editor, file browser, email client, etc., all due to the embedded lisp engine it has. Most of these people are programmers of one variety or another...

If you're a systems admin, VI is a must. vi is the only editor that you can be sure will be on a given server. Further more, vi is far superior to most other editors if all you want to do is open a short file edit a single word and quit. The vi binary of my main server is 282k. I've seen implentations as small as 22k. Compared to the multiple megs of emacs - however fast or slow your machine is VI will load faster than emacs.

The hardest thing about vi is knowing what mode you're in. When in doubt, his escape. The hardest thing about emacs is controrting your hand to hit all of the keys needed for a given command. Everyone know emacs stands for Escape, Meta, Alt, Control, Shift. Heck, my keyboards doesn't even have a meta key :(

While it may be fun to start flame wars with questions like this, there's only one way to answer the question for yourself:

1 Open up emacs and run the tutorial
2 Open up VI and run the tutorial.
3 Open an editor that doesn't need a tutorial.
4 Decide which you like best.

You will of course, have no choice but to chose VI due to its technical superiority and ease of use.
posted by jaded at 12:27 PM on June 16, 2004 [1 favorite]


When I log into my Xenix system with my 110 baud teletype, both vi
*and* Emacs are just too damn slow. They print useless messages like,
'C-h for help' and '"foo" File is read only'. So I use the editor
that doesn't waste my VALUABLE time.

Ed, man! !man ed

ED(1) UNIX Programmer's Manual ED(1)

NAME
ed - text editor

SYNOPSIS
ed [ - ] [ -x ] [ name ]
DESCRIPTION
Ed is the standard text editor.
---

Computer Scientists love ed, not just because it comes first
alphabetically, but because it's the standard. Everyone else loves ed
because it's ED!

"Ed is the standard text editor."

And ed doesn't waste space on my Timex Sinclair. Just look:

-rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed
-rwxr-xr-t 4 root 1310720 Jan 1 1970 /usr/ucb/vi
-rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs

Of course, on the system *I* administrate, vi is symlinked to ed.
Emacs has been replaced by a shell script which 1) Generates a syslog
message at level LOG_EMERG; 2) reduces the user's disk quota by 100K;
and 3) RUNS ED!!!!!!

"Ed is the standard text editor."

Let's look at a typical novice's session with the mighty ed:

golem> ed

?
help
?
?
?
quit
?
exit
?
bye
?
hello?
?
eat flaming death
?
^C
?
^C
?
^D
?

---
Note the consistent user interface and error reportage. Ed is
generous enough to flag errors, yet prudent enough not to overwhelm
the novice with verbosity.

"Ed is the standard text editor."

Ed, the greatest WYGIWYG editor of all.

ED IS THE TRUE PATH TO NIRVANA! ED HAS BEEN THE CHOICE OF EDUCATED
AND IGNORANT ALIKE FOR CENTURIES! ED WILL NOT CORRUPT YOUR PRECIOUS
BODILY FLUIDS!! ED IS THE STANDARD TEXT EDITOR! ED MAKES THE SUN
SHINE AND THE BIRDS SING AND THE GRASS GREEN!!

When I use an editor, I don't want eight extra KILOBYTES of worthless
help screens and cursor positioning code! I just want an EDitor!!
Not a "viitor". Not a "emacsitor". Those aren't even WORDS!!!! ED!
ED! ED IS THE STANDARD!!!

TEXT EDITOR.

When IBM, in its ever-present omnipotence, needed to base their
"edlin" on a UNIX standard, did they mimic vi? No. Emacs? Surely
you jest. They chose the most karmic editor of all. The standard.

Ed is for those who can *remember* what they are working on. If you
are an idiot, you should use Emacs. If you are an Emacs, you should
not be vi. If you use ED, you are on THE PATH TO REDEMPTION. THE
SO-CALLED "VISUAL" EDITORS HAVE BEEN PLACED HERE BY ED TO TEMPT THE
FAITHLESS. DO NOT GIVE IN!!! THE MIGHTY ED HAS SPOKEN!!!
posted by electro at 12:29 PM on June 16, 2004 [3 favorites]


If you use ED, you are on THE PATH TO REDEMPTION.

... and this is where all these discussions eventually wind up. When in doubt, the preferred editor of whoever you share an office/household with is a good place to start.
posted by jessamyn at 12:38 PM on June 16, 2004


If you're going to do any programming, then Emacs and (especially) Vim are certainly the cream of the crop of powerful editors. But if you don't want to invest the time to learn one of those, there are much better options than pico (which was designed for composing plaintext email). NEdit is very straightforward to use, but doesn't deny you useful features like syntax highlighting. I hear JOE is another good choice, especially if you used Wordstar once upon a time.
posted by Galvatron at 1:48 PM on June 16, 2004


Another vote for NEDIT here, I use it for programing all the time as well as standard text edition. It has built in syntax hilighting for a number of different programing lanquages, including shell scripts, makefiles, MATLAB M files, C++ and Java.
posted by phatboy at 2:40 PM on June 16, 2004


I used emacs in school and learned all the key bindings and it was great. Vi was evil.

Then I got a job where I had to edit files on random unix servers. AIX and such. They don't have emacs. They won't install emacs. You're shit out of luck. So I had to learn vi. And now it's easier to just use vi.

:wq
posted by smackfu at 5:30 PM on June 16, 2004


Once you get the key bindings down, vi(m) is great. It's a full featured, powerful text editor that runs quickly.

emacs is a hog, in my experience, but easier to pick up.

I use vim from the command line and yet I find myself typing ZZ instead of command-S in BBEdit (which I've been using for way longer).
posted by maniactown at 7:24 PM on June 16, 2004


vim, vim, vim.

Once you learn the key motions, they become remarkably fluid after a while, and vim allows mouse/click interaction in the meanwhile.

Also, you can sortof train yourself on this by plaing nethack for a few months.
posted by weston at 9:25 PM on June 16, 2004


I only know vi, and this means I'm rarely stuck without an editor I know how to use. It's not "evil." In fact, as a writer, I found it an interesting new way to navigate and edit text. It's the one application I can name which not only allows you to forego use of the mouse, but can, if you're good, do as much and even faster than a mouse. I've never gotten as good with it as I'd like, though.

I also prefer Win2K to Mac OSX, so if this qualifies as "evil," ignore what I said before.
posted by scarabic at 10:10 PM on June 16, 2004


Ed is the standard text editor.

Back in my day, we wrote our text files with a magnet. And we liked it. Uphill both ways etc...
posted by abcde at 10:42 PM on June 16, 2004


i hope (for their sake) mars saxman is exaggerating a little.

yes, just a bit, for dramatic effect. but the core is true: I never did actually manage to get any work done in either vi or emacs.
posted by Mars Saxman at 8:01 AM on June 17, 2004


i love pico because its so easy, i'm no programmer, so screw you nerds
posted by yeahyeahyeahwhoo at 10:01 AM on June 17, 2004


« Older A friend without a Metafilter ...   |  What are you personal suggesti... Newer »
This thread is closed to new comments.