views:

4154

answers:

24

Right up front: I do not want to start a religious war.

I've used vi for as long as I can remember, and the few times I've tried to pick up Emacs I've been so lost that I've quickly given up. Lots of people find Emacs very powerful, however. Its programmability is somewhat legendary. I'm primarily doing Solaris+Java development, and I'd like to ask a simple question: will my productivity increase if I invest time in getting my head around Emacs? Is the functionality that it offers over Vim going to be paid back in productivity increases in a reasonable timeframe?

Repeat: I don't want a "my editor is better than yours" answer. I just want a yes or no answer as to whether it's worth investing the time or not. Will my productivity really increase?

+3  A: 

No (and I've used both).

Mark Nold
+14  A: 

I don't want a holy war, but please answer a highly subjective question with a yes/no answer.

Yes, you may see a productivity increase because of the powerful functionality.

No, you will not see a productivity increase because the patterns and metaphors used in emacs may not align with you brain.

Alan Storm
+10  A: 

Emacs documentation is a forest. I came from Emacs to Vim when I realized how organized Vim's documentation is, and how chordable many of the features are. I don't know what lies down the path of an Emacs expert, but I will warn you that learning to do anything useful in it takes a long time, and won't make you any better at nethack. Stick with Vim.

Textmate is a better Emacs for Macs, though that won't help you with Solaris. Eclipse is kind of cool, and has a lot of plugins.

Nick Retallack
+35  A: 

I prefer emacs to vi, but I'm comfortable in both.

There are some things that you can do in emacs that make it more powerful than vi, but not all of them are even programming-related. (Can you send email or read news from within vi? No, but who cares?) If you're comfortable with lisp (I'm not), you might be able to write add-ons and modes and stuff to make your life easier, but that's just likely to be syntax colouring and brace matching and eye candy like that.

I will stop rambling now. Will your productivity increase using emacs? No.

Graeme Perrow
Wow, my first personal attack on SO! How exciting!
Graeme Perrow
+1 for the comments. We need more of this on SO! ;-)
rq
Haha, yeah. +19 on this? I've noticed a lot of hostility towards emacs on SO.
temp2290
And IDEs, too. I'm sporting a -5 for offering the opinion that for software development, a purpose-build IDE might be a better choice than vi or emacs.
trenton
-1 Because this post clearly provides misinformation about emacs - namely that its increased power is only useful in unimportant areas like reading email/news (what about emacs extensions like muse and slime) and that the only reason to learn elisp is to make emacs colorful (how about creating time-stamps in files that are automatically updated on save to name a simple extension I use).
Eric Scrivner
This answer is deceiving. It's a total strawman argument. News reading is not what makes Emacs different or powerful. Whether Emacs will increase your productivity depends on what you want to do with emacs. If you program in R, Vi lacks an ESS-like mode (same goes with Lisp and Slime). Emacs **will** increase your productivity in these areas. If you have a complex build cycle, and you want to write functions to automate this in your editor, Emacs can lead to more productivity.
Vince
+4  A: 

Looks like it's a 'no' then. I'll stick with vim.

Andrew
+2  A: 

I want to look into emacs further, but I just can't use it for long stretches of time; it hurts my hands. Am I doing something horribly wrong?

Bernard
You may want to try switching Caps Lock and Control, if you haven't already.
Marcel Levy
I don't think I could stand using Emacs without having the Control key next to 'A' like God intended. :-)
cjm
I have the same problem - possibly because I'm a small-handed woman and thus far outside the normal curve of emacs users?
Kena
@Kena: I'm a big-handed man, so maybe that's not it either. The mystery deepens. ;p
Bernard
I used to have terrible pains in my pinky from constantly pressing/holding Control. I'm on a Mac, so I switched the Control and Command keys, and use my thumb to press/hold Command. I've never had the pain since.
Steve
I prefer switching Ctrl and Alt (Windows) as well...no strain at all on the pinky!
Kevin Tighe
+22  A: 

Depending on how you code, you may see a productivity increase. For background, I'm also a long-time vim user, but I learned emacs about 2 years ago, and now use them interchangeably.

What drove me to the point of actually learning emacs was its useful ability to have a large number of files open at once, and to easily switch between them. I was in the middle of introducing a feature that added and touched a large number of classes. (This was C++, so there were typically two files per class.) Since I was still firming up the interface, I would typically be in the middle of updating one file when I would realize that I needed to change another.

With gvim, it was easiest to open a new window for each file, which was starting to get unwieldy. With Emacs, though, it was simple to open a new file in the same window (Ctrl-x, Ctrl-f). Once Emacs has a file open, it's very easy to switch back and forth between the open buffers (Ctrl-x, Ctrl-b).

Taking that one step further, a single emacs session may open many windows, so in addition to splitting the window vertically, I could decide, without interrupting work on a file, to open another next to it, letting me effectively work side-by-side while still keeping each window at the default 80-character width.

There are still some things that I find easier in vim (e.g. block-select mode, simple macro recording, diff mode), and things that are easier in Emacs (line alignment, file/buffer management, window/screen management). Therefore, I find myself alternating between the two (and sometimes using both simultaneously), depending the editing task I anticipate.

If you're still unsure, I'd suggest trying it out. Run through the Emacs tutorial and then use it to write code for a morning or a day, leaning heavily on the help. If you still don't like what you see, stay with vim. Regardless of what the editor brings to the table, your familiarity and knowledge of the tool will by far be the most important factor in your productivity.

shmuelp
In vim you can open > 1 buffer. :e filename. Then :bn and :bp go to the next and previous buffers. I have TAB mapped to :bn in normal mode, works wonderfully. Also :split, ctrl-w to change windows... Vim does all of that.
rq
I agree that vim can do it, but once you have multiple buffers open, you have to cycle through them or use the mouse to select from a menu. In Emacs, the buffer name comes from the filename, and you can use that to select the buffer, which is much more usable.I am intrigued by mapping tab to :bn.
shmuelp
When you say “window,” do you mean another instance of gvim or do you mean a Vim window inside the same gvim instance window?
Aristotle Pagaltzis
You can also use tabs in vim 7.x. :tabe <file> to open a tab, :tabp to switch to previous tab, :tabn to switch to next tab. You can setup macros for these so you can use them with shortcuts.
asksol
@shmuelp "nnoremap <Tab> :bn<CR>" (without the quotes) in your .vimrc file. Now :e another file and tab between them.
rq
In vim the buffer name is also derived from the file name. :b partialname<CR> will take you to a unique partial name. Or hit tab to select the proper name. Or use :b # or #ctrl-6 to go to a particular buffer number. Or just ctrl-6 to go to the previous buffer.
Zathrus
I use vim constantly with a few dozen buffers open. I always use either tags to jump between files, or :b partial-name. I can't imagine having so few buffers open as to make :bn worth using.
Imbue
i have "nnoremap <tab><tab> :BufExplorer<cr>" in my vimrc, frequently have > 50 files open
dysmsyd
A: 

You're productivity will increase if you decide to put the time in to program your text editor. Of the two editors, emacs presents a better framework or constant customization. If you don't program your text editor, just stay with what is comfortable.

Jay Stramel
It should probably be noted that vim is probably easier to customize in regard to common user settings (line numbers, wrapping, ...) - the common stuff. Most of these things which take only a line in vimrc takes several less "intuitive" options in emacs rc file.
ldigas
+4  A: 

I love emacs and use it every day.

That said, I don't think the cost of learning it will be recouped by productivity gains down the road.

If you're programming Java, you need a good IDE. Emacs goes a fair way towards being one, but let's face it, IDEA et al beat it hands down. (emacs probably inspired a lot of those IDEs, but that's another story).

gerikson
+2  A: 

Along the same line of not looking for a religious war (but go ahead and downvote me if you feel you must), why do you feel that the only option to vi is emacs? Is it the OS you develop on, or just the options you explored?

The Java development landscape enjoys some of the best IDEs these days (both free and paid for), if not the best when it comes to code editing and refactoring support.IntelliJ IDEA even has a vi plugin that can help you feel more at home, for instance (not sure if something similar is available for Eclipse). While changing tools does imply a learning curve, the time spent doing it might be worth it if the leap is big enough.

Andrei
You're right, Andrei. We actually use IntelliJ IDEA for a lot of stuff at work, and I'm looking at Eclipse right now. I know I'm somewhat old fashioned, but I really prefer the command line for a lot of Unix work because it's just so useable. In the Windows world it's another matter...
Andrew
+5  A: 

Emacs will provide a productivity gain if you're willing to learn and customize it to fit your needs. Most people are not. To increase your productivity you must use the tool for more than simple editing - most people never progress past simple editing.

Here's a quick test: have you customized your window manager to make your environment more efficient (tailored to fit your needs)? If 'no' then likely you will not get the ROI by learning emacs.

That being said, if you're developing Java, Eclipse is the standard answer, so your question is pretty moot.

Trey Jackson
IntelliJ IDEA is the Java IDE here, and I don't particularly like it, whcih is why I spend most of my time bouncing back and forth from the bash prompt. I prefer a command line to IDEA.
Andrew
+17  A: 

vi is a kitchen knife.

vim is a really nice, sharp, balanced chef's knife.

Emacs is a light saber.

Most of the time, my job requires me to chop vegetables. Occasionally, I have to take on an entire army of robots.

I've been using Emacs for 20 years. I'm typing in Emacs right now with a widget called "It's All Text" that lets me suck text in and out of text boxes in Firefox. I can go really fast in Emacs. I am significantly less productive without it.

This is highly debateable, but I also think that learning Emacs can teach you a surprising amount about programming.

jfm3
just for others, there is a plugin called Vimperator for firefox, provides a vim like interface, and hitting ctrl-i while a textbox is focused pops up vim
dysmsyd
+33  A: 

[Disclaimer: personally, I prefer Vim. Disclaimer disclaimer: read on.]

Vim excels in the small: by making motion and action separate concepts and providing facilities for complex repeats, you can perform incredibly powerful editing operations in just a short sequence of keystrokes. You can easily do things in Vim in the normal course of editing that would require you to drop down to scripting in Emacs. Also, most of the power you use comes out of the box, so even if you have extensive .vimrc customisations, chances are you will be able to work productively with any Vim installation.

Emacs excels in the large: by mapping all of its UI concepts directly to basic constructs and concepts in Elisp, it becomes very easy to globally introduce features for specific kinds of files or circumstances, making Emacs something like a text-based and much more structuredly programmable form of Excel. This presumes that you are going to spend a lot of time customising your environment for personal needs and preferences. Of course, Emacs does do its best to make it easy to stay inside that one environment for everything and anything you may want to do.

Ultimately, neither is superior. They offer different styles, and depending on your proclivities, one or the other will suit your personal needs and way of thinking better. It is always helpful to know both (plus more editors), of course. But you aren’t going to be appreciably more productive this way or that.

Aristotle Pagaltzis
+1 for being honest with the disclaimer. I would also like to add that one possibility is to try the (VIM mode) in emacs.
Pharaun
A: 

vi is modal (i.e. insert mode vs. command mode). Emacs is modeless (you type a letter, you get it on the screen. Every time). I think modelessness is more human, so I chose Emacs about 12 years ago and am glad I did. It's powerful and was easy for me to learn.

Jason Dufair
Not true. If you open Emacs and start typing, do you get characters on the screen?
alamodey
@alamodey: Yes you do. With the default configuration, you will be typing into the *scratch* buffer.
paprika
I disagree that Emacs is modeless. Type C-x. Now Emacs goes into a mode where it waits for a command. Any letters you type now are interpreted as the command, not inserted as text. Same with C-h. Or <Esc> (kinda like Vim). Difference is that in Vim you usually _stay_ in command mode all the time.
thomasrutter
Emacs is not modeless, it is just less modal than vim
EoghanM
@EognanM - I agree, best definition so far. However, I must admit as the computer industry progressed, emacs's approach is what other editors have started following. Very few editors today have vim's bindings and way of operation.
ldigas
+1  A: 

One good reason to learn Emacs is because other programs use Emacs keybindings too. You can use Emacs keybindings at a bash prompt, for example, or anything else using GNU readline. It's good to learn the basic movement and word/line deletion and undo/redo chords in Emacs so that you can use them in other programs. Your productivity will increase in those other tools even if you never use Emacs again.

I know Vim and Emacs, and Vim fits my brain and my habits better. But other people claim the same about Emacs. You never know for yourself unless you try. It doesn't take that long to learn Emacs well enough to see whether you're going to like it.

Brian Carper
+2  A: 

How fast do you type? If you hunt and peck, then emacs is not for you. If your fast tho, it can help not having to grab your mouse all the time.

dicroce
+2  A: 

Twice I've tried to learn Emacs. It just doesn't fit how my brain works, and so I don't use it.

Emacs (or vim) is not significantly better than vim (or Emacs). Both have many options to add to them that allow them to do amazing things. I have no doubt that anything you can get done in Emacs you can also get done in Vim, just not standard.

Try Emacs. See if it fits better. It's a no-lose situation.

Andy Lester
A: 

I really see no reason to switch. I've used vi for a long time and am quite comfortable with it; about every six months I would install emacs to give it a go, then quickly just switch back. Yes there were things I much preferred about vi, but the main reason I never stuck with it is because the time investment to fully learn another editor when I already know an extremely capable one isn't worth it.
I'm reminded of this rather dated study.

In my opinion, SLIME is about the only reason to switch to emacs if you're already proficient with vi.

+1  A: 

vim and emacs, they are THE most capable editors and have been for quite some time. If you know one really well, I doubt that you will gain that much in the process...

However, it is always a good idea to look into what plugin that are available since a couple of new plugins can do wonders for the productivity.

/Johan

Johan
A: 

Since vi/Vim and Emacs are pretty close in terms of what they can or cannot do, productivity with these two editors comes from experience in using it.

In my opinion, being a programmer it won't take you long to get the general idea about Emacs once you start using it. Others can only say so much, you got to try it out for yourself to know it.

As for me, I use both. It's like taking more than one weapon to a war, use the right one in the right circumstances. ;)

Sujoy
A: 

Will my productivity really increase?

For the first few days/weeks, absolutely not.

After you stop having to read through the tutorial every time you want to edit something - sure..

Emacs is more "powerful" than vim, it's scripting engine is far more flexible, and there are far more scripts, modes and the likes built around emacs.

That said, the opposite is true.. If you spent the same amount of time improving your knowledge of vim, you'd could be just as productive..

Maybe not productive in the same way - I'd say vim is quicker for editing files, emacs is better at doing everything else (again, I would personally say things like flymake-mode, VCS bindings are such are quicker to use than the vim equivalent)

dbr
I wouldn't go that far as to say there are far more scripts, modes ... built around emacs. Vim has a filetype file for practically every type of file out there, while emacs often uses one mode for several filetypes/languages. Also, vim has a much more active community, and more plugins. The part that I agree with is that emacs lisp is more powerful than vim's script, but since vimscript resembles today's dynamic languages a little (ruby, py) lately it's been getting a lot more attention than e'lisp. ... that's it. Not trying to start a flame, just my opinion.
ldigas
+5  A: 

I used Vim for 10 years leading up to delving into Emacs 2 years ago. I have a reasonably fresh recollection of just how my productivity curve modified over time.

My points are all conditional, YMMV depending on your strengths and experience.

If you have used Unix and the command line long enough that you are familiar with C-a, C-e, C-n, C-p, C-k, C-y, etc as they function on the shell, it will not take long to transition to using those same bindings (the defaults) in Emacs. I recently discovered that XCode uses these bindings as well.

If you are comfortable with an always running editor, tending buffers (like you would browser tabs) and thus living in the application (like you would with Web2.0 apps in the browser), Emacs will likely show immediate productivity enhancements.

If you generally work in projects of many related files, this persistence pays some added benefits in maintaining context to that buffer. Each buffer is contexted at its open file allowing for convenient use of various productivity boosting tools for your that project (like grep-find, eshell, run-python and slime). This coupled with text completion, yasnippets, etc start to look a tiny fraction like an IDE although ad-hoc and heavily individualized by your configuration. This is apart from more civilized Emacs IDE-like services like ECB.

My productivity took a hit initially as I typed "jjjkkk" constantly Esc-Esc-Esc-Esc for the first week or so. The following week I cautiously started using the right navigation keys. Then I discovered the configuration file... Honestly, if I had had Emacs Starter Kit from the start, I would have said my productivity slowly worked back to parity over the 3rd-4th week but I did go down the config file rabbit hole. A co-worker of mine, though, has just transitioned from vim to emacs and he just grabbed the Starter Kit and he is on his way. First week in and he seems comfortable and enjoying all the surprise benefits (that sensation will probably last a decade).

Finally, if you make mistakes you will immediately gain productivity (and confidence) from the circular kill/yank-ring and undo-ring. I am also personally a fan of region specific undos.

My short answer is Yes it is worth taking 3-4 weeks of a diminishing productivity-hit to learn Emacs. Even if you decide you prefer a streamlined unix utility combo over Emacs for development you will derive from it an education widely applicable beyond the editor.

jjames
Good point about the command line similarities...a co-worker here said the same thing.
jkp
A: 

I agree with Alan Storm: "because the patterns and metaphors used in Emacs may not align with you brain"

This is a very important factor. Different brains adapt differently to different interfaces.

Some of the main - and easily available - features I really love Emacs for, and I count as productivity enhancers:
1. "yank-pop" facility - every cut/copy is saved into a stack so you can later choose which to paste (don't know if vi / Vim has this but most Java IDEs don't)
2. the Ctrl-key navigation mapping - this allows you to navigate your file without moving your hands off to use the arrow keys. (key-binding in other editors helps of course)
3. available on almost every platform (true of vi/Vim too of course) - whether GUI- or text-based (Java IDEs are available on most platforms too but only in GUI mode, and are significantly larger and need to be installed separately whereas Emacs is generally more widely available - BSD / *nix / Linux / Mac systems
4. I prefer my editor to stay out of the way until I need it - Emacs' spartan display forces me to think before I type.
5. The basic navigation keys in Emacs are kind of universally available - on my Mac OS, I can use these keys in terminal, mac mail, etc.

Ultimately, if Emacs' philosophy appeals to you, you will put in the extra effort to learn it. And it will reward you.

alan-p
1. Vi(m) has something vaguely similar; 2. Vi(m) doesn't even need the Ctrl key for this; 3. You said it.
Artelius
+2  A: 

I was very happy with my Vim, but once I heard of org-mode, I started learning Emacs. org-mode could be one strong reason to learn Emacs.

ticktock