76

I started coding around 5 years ago. I was introduced through Java and Eclipse which both have substantial stigma attached in the programming community. A number of people at the company I currently intern at prefer emacs or vim. I can't see how a basic text editor is faster or easier than an IDE in general although I appreciate some things like building tend to be faster from the command line.

Is this a case of the 'old-boys' club or can it be more efficient to program a project in this way?

Can you provide some use cases to demonstrate? If I were advocating Eclipse I'd say refactoring and auto-completion were pretty handy tools.

Gav

gav
  • 29,022
  • 23
  • 65
  • 90
  • 25
    You didn't say "basic" text editor, did you? :-D Emacs can be everything: text editor, IDE, media player, image viewer, pdf viewer, web browser, ... I have to admit, its not superior in every of these roles but anyway ... ;-) – danielpoe Aug 28 '09 at 13:25
  • 20
    Emacs or vi(m), it all depends on your religious beliefs, are like meth to {insert IDE here}'s weed. IDE's are but gateway drugs to the true power of the dark side. – beggs Aug 30 '09 at 13:20
  • 6
    @danielpoe: you forgot psychologist! – beggs Aug 30 '09 at 13:21
  • the best use case would be looking way more hip than the rest of your co-workers. – Can Yegane Jun 28 '14 at 21:24
  • 3
    Has 59 Up Votes but closed as not constructive by mods. Man these moderators really hate every question. – DollarAkshay Aug 21 '15 at 10:58
  • Closed as non-constructive. So to answer your question - yes this is a case of the 'old boys' club. Check out how the inverse of this question was loved by the moderators http://stackoverflow.com/questions/208193/why-should-i-use-an-ide – Kellen Stuart Jul 07 '16 at 17:06

15 Answers15

61

Vim / Emacs

  • Very fast/efficient code writing
  • Low memory footprint
  • Quick access to command line
  • Infinite possibilities through scripting/plugins
  • Never have to leave the keyboard

Eclipse

  • Full-featured IDE for many languages
  • Great refactoring support

All of them

  • Cross-platform
  • Feature rich
  • Extensible through plugins

I typically find myself writing volumes of code through vim and performing debugging tasks through my IDE. Familiarity with the code base is certainly a factor, as an IDE is a great tool for jumping around and learning unfamiliar source code.

Corey D
  • 4,689
  • 4
  • 25
  • 33
  • 1
    +1 for having the clearest and most organized answer, IMHO. – Android Eve Jan 06 '11 at 20:20
  • I found myself really enjoying IntellIJ IDEA because it has excellent vim key bindings with all the powerful features of a full IDE. QtCreator also has decent vim key binding support. I have yet to find a usable solution within Eclipse, however. – Corey D Jan 09 '11 at 08:43
  • 1
    It's valuable to master an editor that works on the command line, as well. Both Emacs and Vi(m) do, but IDEs, in general, do not, nor do the more modern power-editors, like TextMate or Sublime Text. – R. P. Dillon Jul 19 '12 at 20:30
51

I got started in IDEs like Eclipse, but switched to Vim about 2 years ago.

Reasons you may want to use a text-mode editor:

  • It can be used as an IDE for just about any language (you learn it once and use it for everything)
  • It can do all those fancy things like auto-completion, refactoring and many more complex operations, which you can extend by adding macros or plug-ins
  • It works just about everywhere (and can be used through an SSH shell)
  • You don't need a GB of ram to run it

If you really persevere, you will find that working in an editor like this will eventually be faster, and in fact becomes ingrained as a sort of 'muscle memory'. This means you can code without slowing down to think about the process.

Oreo
  • 529
  • 3
  • 16
Aram Verstegen
  • 2,407
  • 1
  • 17
  • 15
  • 8
    To make vim complete code you should always tweak something. – Mykola Golubyev Aug 29 '09 at 13:14
  • 5
    I think it's sort of implied. Eclipse requires just as much if not more tweaking, in my experience. – Aram Verstegen Aug 30 '09 at 21:41
  • 51
    And vim starts up faster than you can say "Eclipse". – Ludwig Weinzierl Sep 02 '09 at 16:35
  • 3
    Emacs on the other hand requires at LEAST a GB of RAM :P I love the beast. – kjfletch Sep 04 '09 at 10:45
  • 4
    @kjfletch I have no idea what version of Emacs you're using... my version never uses up very much RAM. Even with a bunch of files open in buffers, I never notice a slowdown due to Emacs. – Jonathan Sternberg Apr 18 '11 at 04:58
  • 1
    Correct - `ps aux | grep emacs` shows 0% of my memory (i.e. negligible) and 0.3% of my processor. – Aaron Newton Aug 03 '12 at 12:01
  • I use Eclipse for Perl and Python coding. With a bit of tweaking it will do everything you mentioned above, with the exception of running in less than a gig of RAM. OK, Vi will be easier to get running over ssh, but there are plenty of thing easier in Eclipse, and they won't require remembering cryptic commands. – wobbily_col Jul 02 '13 at 08:57
  • @JonathanSternberg I think it depends. My Emacs with a loaded addons and 17 ±3 open buffers takes about 50Mb, where's the just opened Emacs with -Q option takes 15Mb. Nothing unusual that for your convenience you have to add more and more addons — hand written, either someone's. All these addons takes pretty much RAM due to elisp idiosyncracies. – Hi-Angel Sep 04 '14 at 05:27
  • I used Emacs 'keyboard only' long time ago, but I must say Eclipse has tons of shortcuts too, you may not use the mouse for hours if you know them... – Christophe Roussy Feb 24 '16 at 10:25
28

The argument "Eclipse for Java" is a different argument than "Eclipse for [something that isn't java]". Eclipse does rock for Java.

I mean, vi is like a screwdriver, or maybe a swiss army knife, and Eclipse is like a big CNC combo mill and asphalt spreader. You don't exactly compare them, you kind of just use both.

Also, are you working inside something giant, which you know little about, but which Eclipse understands? An example would be working on Eclipse itself. Here, Eclipse has perfect visibility, total language support, and you need the toast prompts and the documentation links.

But if you are typing in a 100-line Ruby program to convert an SQL database, Eclipse doesn't add much value, especially considering its baggage.

It's also critical to set up vi right, or you won't grok the appeal. Autoindent, showmatch, tab handling, and various other options should be set. You should have a easy way to generate a tags file. Google can find tag generators, or just write one from scratch, with a few lines of shellcode and sed(1).

I don't consider refactoring to be a criteria. That's not something you do once an hour or even once a day. Sure, fire up the big IDE when you need to refactor. Oh, and don't expect automated refactoring of anything except Java.

Finally, vi can actually do a lot of things that the IDE can't begin to do. The grouped regular expression global substitution is kind of a generalized refactor-anything engine. To appreciate the vi gestalt you need to learn the line (":") mode. Briefly, it's like having sed(1) inside your editor.

DigitalRoss
  • 143,651
  • 25
  • 248
  • 329
  • 20
    I disagree on the frequency of refactoring. Refactoring can be as simple as renaming a class/method name and having the IDE do the hard work is a big time saver. I know of a team who had their trainee spend 2 weeks going through their code manually doing renames... – SteveD Sep 02 '09 at 08:33
  • 7
    +1 for pointing our the "Eclipse for Java" thing. "Eclipse does rock for Java." I agree 100%. – Ludwig Weinzierl Sep 02 '09 at 16:40
  • 17
    Please don't tell people to use substitution for refactoring. – R. Martinho Fernandes Sep 07 '09 at 22:49
  • Didn't I say to use the "IDE when you need to refactor"? But the further away you get from Java, the less IDE refactoring you have... – DigitalRoss Sep 07 '09 at 23:21
  • @DigitalRoss, in principle there is nothing _prohibiting_ Eclipse in getting grouped regular expression global substitution - nobody just took the time yet. – Thorbjørn Ravn Andersen Apr 17 '11 at 17:43
  • I didn't mean to dis refactoring automation in general, which is awesome in Eclipse for, well, Java. As I said, languages like Ruby mostly don't need it and there is no automated Ruby refactoring anyway. – DigitalRoss Jun 12 '11 at 18:52
24

It all depends on what you want/expect and what your usage model is.

If you're looking for a Java IDE, Eclipse is difficult to beat. It's written in Java, for Java, by Java folks.

If you're looking for a tool to edit files from the command line quickly, Emacs or vi both fit the bill.

If you're looking for a tool from which you never have to leave because it can do anything you want (send/read mail, manage projects, todo lists, compile, debug, etc. etc. etc.), then Emacs is more "efficient".

If you're looking for reasons to switch editors, figure out what you want. If you want a better Eclipse, vi and Emacs won't give you that, stick to Eclipse.

If you're looking for a small, nimble editor, vi will fit the bill.

If you're looking for the ultimately extensible editor, Emacs is the way.

Whichever tool you decide to go with, immerse yourself. Learn all of the ins and outs, extend it to meet your needs. Use it to its limits and become efficient in its use.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
  • 5
    +1 for "Whichever tool you decide to go with, immerse yourself. Learn all of the ins and outs, extend it to meet your needs. Use it to its limits and become efficient in its use." – NlightNFotis May 04 '13 at 12:01
  • +1 Each of them has their strengths. Both [Emacs](http://www.emacswiki.org/emacs/Evil) and [Eclipse](http://stackoverflow.com/questions/597117/painless-integration-of-eclipse-with-vim) offer vim emulation, which can provide a consistent interface while you use each of them for what they're good at. – Gordon Gustafson Jul 05 '13 at 21:08
15

Emacs can be a powerful IDE, but having gone from Emacs to Eclipse, I have to say I would never go back. Eclipse just offers so many features that you can't get within Emacs.

Mylyn and scoped views of the data and files I'm using, the debugging UI, CVS UI, are all built in and easy to get and use. I'll use the mouse a little to get'em.

RC.
  • 27,409
  • 9
  • 73
  • 93
  • I don't "need" one, I just prefer to use one and have the nice UI and diff tools that Eclipse provides right inside of my IDE. – RC. Apr 18 '11 at 00:39
  • Maybe the CVS UI is good, but I am really frustrated with Subclipse (eclipse SVN plugin). At this point, I would seriously (and do!) rather use the command line for SVN. – Tikhon Jelvis Apr 18 '11 at 08:06
  • I was mostly referring to the fact that you are using CVS, rather than something that actually works. Not the UI portion. – alternative Apr 18 '11 at 11:12
  • @mathepic - Yes, we have thankfully moved to Mercurial. :) – RC. Apr 18 '11 at 11:54
  • Personally, I like the "do the next logical thing" when using version control with Emacs. – Chen Levy Feb 25 '12 at 08:03
13

First things first. VIM is more productive for programming than Eclipse. Your personal productity in VIM may be abysmal, but the potential cap of VIM is much higher. This is a fact.

VIM is a martial art. It feels unnatural when you first use it. And you can't even make it work. It takes years of practice to gradually become productive. You focus on mastering a little detail at first. Slowly all these bits you master add up until text is flowing effortlessly out of your finger tips onto the screen. Complicated edits that would make your co-worker sigh will jump from your hands before he can finish his exhale. There are few people who can use VIM. Fewer who can use it productivley. And you may never meet a master in your life time. But they are rumored to exist.

VIM is designed to keeep your hands on home-row. Moving your hand from the keyboard to the mouse is demoralizing. It's a gross motor movement. Moving your arm has a phsycological effect that hurts your motivation. Using VIM, someone could bolt your wrists onto the keyboard and you could still easily open up files, split windows, open tabs, build the project, search/replace, change fonts, change colors, etc. And all at lightning speed.

VIM is modal. That means you don't have to do complex key combinations where you hold down control+shift+Key. This hurts your hands in the long run. Instead you execute commands. There is no need for key combos to due to the modal nature.

We store data in our memory like computers do. Our memory can only hold a few values at a time. See how many distinct integers you can hold in your head before they start to slip away. We overcome this human limitation by writing stuff down. If data falls out of our memory we can easily look at what we wrote down to get it back. If your time is spent doing gross motor, physical things you are losing time that could have been spent on processing data in your brain. You want your mind to flow onto the screen without any effort at all. It may not sound like much but VIM's ability to effortlessly transfer what is in your mind to the screen is a BIG productivity boost. It's hard to put in words what I'm trying to say.

VIM supports code completion. Both textual and look-up based. It can pull text from mulitple files. Anything you desire can be had in VIM. Either make it yourself or use something someone else cooked up.

VIM supports goign to definitions with ctags. You can also find all references of an item. Again, anything you desire can be had in VIM.

The scripting of VIM is huge. You can download or create thousands of color schemes and change colors in an instant. Try to change fonts or colors in Microsoft Visual Studio and it will hang for 20 seconds while it loads data. It won't let you store color schemes and you must spend 30 minutes tweaking your colors and fonts every time you want a change of scenery. In VIM you can set line spacing to zero to fit more lines of code on the screen. I get over 80 lines. Visual studio uses 2 pixels of spacing for every line and you can't adjust it!!! Less lines = more scrolling = less productivity = forced to use small fonts for more lines = eye strain.

Split windows are opened in an instnat in VIM. It's usefull when you need to look at data in one section of the code that's far from the place you are typing (or in a different file). You don't have to spend time resizing windows, or worry about GUI windows overlapping each other and falling behind each other. Un-related code windows can be opened in tabs as to not take up screen space, but allow quick switching.

VIM as an IDE: http://www.youtube.com/watch?v=MQy2rVOf-z0&feature=fvwrel VIM the revenge: http://www.youtube.com/watch?v=lQNFfhC4QI8

mike
  • 155
  • 1
  • 2
  • 9
    "It takes years of practice to gradually become productive. " .. well, we don't live forever, why would you spend your life complicating things when you can be productive in a matter of hours? It is like listening music using a command line software instead of Winamp. – Sorin Trimbitas Jan 25 '13 at 10:02
  • @SorinTrimbitas Same reason people invest money to benefit from compound interest instead of spending it the minute they earn it. Sure, you can be productive in a matter of hours, and then you can maintain that flat-lined productivity rate for the rest of your life. Or you can put in some initial investment, and see your productivity increase to a much higher rate later. Also, that quote is misleading. It doesn't take years to become as productive as you were with your IDE. Rather, it means that you will continuously increase your productivity the more you use it. – JBentley Feb 10 '20 at 13:04
8

I've used vi for years to edit code in a variety of languages, and really love it. But I've found IDEs like Eclipse to be even nicer for Java development, and now I tend to work in Eclipse almost entirely. I drop out to use vi from time to time for a few specialized activities like bulk-inserting copyright notices, mainly those dealing with certain kinds of rote edits that aren't well automated in Eclipse. I also have my Windows .java file type mapped to vi for when I just want to look at a source file without waiting for Eclipse to open up.

Some of the attractive features in Eclipse are:

  • method name completion
  • error highlighting
  • pop-up javadoc comments
  • refactoring

I do find it a lot more efficient than vi in general, so you should try it out and see if it that holds true for you too.

Jim Ferrans
  • 30,582
  • 12
  • 56
  • 83
6

I remember reading somewhere about a study which showed that people perceived keyboard shortcuts as more efficient than mousing, when in fact it wasn't always.

Another psychological effect is that we attach value to things which are expensive, i.e. since Emacs is harder to learn it must be better in some way.

I think those effects could explain a lot of the extreme affection some people have for Emacs/Vi.

However, in the case of Eclipse, I find it can be very slow and even crash occasionally, but that is not a case against IDEs in general.

I use both Eclipse, VS and Emacs regularly. I would use TextMate too, but I don't have a mac anymore. It depends on what I am doing, more specifically, what system best supports my language and tools.

I know people who spend considerably more time programming their editor, than they spend doing something useful. Some of them even admit themselves that they only do it for the challenge. Other people often claim that Emacs/Vi can do much more than IDEs, because they are scriptable. Well, most IDEs (including Eclipse) can also be scripted. In that sense almost all editors are equivalent (though, I admit, some editors are more easily scripted than others).

If you like IDEs, my advice is to keep using one. There is no One True Editor.

EDIT:

This seems to be the article Nick Bastin is referring to. I agree that it is far from a definitive source. However, I still think my point about perceived and real productivity not being the same thing still holds.

Jørgen Fogh
  • 7,516
  • 2
  • 36
  • 46
  • 21
    That "study" was done by Apple in 1989 (not a truly scientific study, but focus group research), when they were trying to evaluate the mouse as actual "new" technology to people used to using their computer entirely with a keyboard. Times (and interfaces) are quite different now, and even Tognazzini agreed that editors are one place where the keyboard was (and is) always faster (assuming, of course, that your keyboard shortcuts are not something you have to think about). – Nick Bastin Aug 29 '09 at 20:34
  • 1
    Emacs is a big REPL, so if you code in emacs lisp and press C+X C+E you can see the intermediate values of a bunch of s-expressions. Its also possible to program it to show you every single intermediate value without having to press C-x C-e and this beats out every bloated Java or Visual Studio IDE by a long mile... https://www.youtube.com/watch?v=TgHvRcbYJ-8&t=38s Emacs only takes up 50-100 MB on my PC compared to gigs of ram needed by ATOM, Visual Studio, Eclipse, and IntelliJ. – aoeu256 Sep 21 '19 at 16:57
4

It depends on the languages.

For Java or .NET use an IDE (Eclipse,Netbeans,Visual Studio...).

For almost all the other languages(C,C++,ruby,python,haskell,lisp...) vi and emacs are better in my opinion.

hiena
  • 935
  • 1
  • 8
  • 9
3

I would anytime go for emacs rather than eclipse. I also have to say that bare bone emacs, is not that great, but after some tweaking, you will never want to let it go. In particular I will tell you how helpful emacs was while writing my Master's thesis, that should make clear why Eclipse is inferior, just because it is less versatile.

I my master thesis I wrote in the following programming languages: C++, Python and R. Complementary, I had to write the thesis, for which I used LaTeX. Moreover, I had to write a bunch of shell scripts and cmake scripts. Guess what? Emacs has great support for all of it. Specially, it was a pleasure to work with AuCTeX to produce LaTeX documents. Then, Emacs provides the great ESS mode for working with R. Likewise, it provides facilities for python. Once I had my cmake scripts for building the C++ code, I only had to call compile from withing emacs and I was done. Eclipse cannot do this things altogether, therefore you will need to learn to use many different programs. Note taking? There is org-mode for that, and it is great!

And then, my program needed of a very powerful computer (not like any laptop). So, I could just do everything remotely from within emacs!!!! Using tramp, I found myself doing remote interactive evaluation of R code, remote compiling, executing and debuging C++ code, and everything within the same good local emacs window I had been using. In contrast, my friends who used a separate tool for everything were much slower in developing software that was meant to run in another computer.

Like this I have some other stories, but I think, this will give you a good idea on the things you can do with Emacs. All in all , I think choosing to use emacs (despite the learning curve) has been the most productive decision I have ever made.

Hope it helps.

  • 1
    +1 fo mentioning that you need to configure Emacs before using. It is a common error, which resulted to me a few attempt to Emacs before I finally got it. The reason is that if you run an IDE either an editor you awaits for it to work out of the box. Cuz of this misunderstanding I was often blamed Emacs for not matching with what I heard of it, and threw it away. Until a next popup article glorifying Emacs. – Hi-Angel Sep 04 '14 at 05:48
3

The efficiency provided from vim/emacs is mostly afforded by their heavy keyboard use. In these programs you can do most anything directly from the keyboard, rather than having to stop and use the mouse.

Jon W
  • 15,480
  • 6
  • 37
  • 47
2

I'd say the actual vim/emacs editors are far superior to the Eclipse text editor in terms of the shortcuts they offer. However, I completely agree with you about refactoring.

Most people have to write scripts to do the sort of level of refactoring Eclipse is capable of. I think part of it is bragging rights or people just doing it the same way they always have.

Mike McQuaid
  • 9,615
  • 6
  • 33
  • 38
1

We've had this argument at work recently. My take was that one single feature I couldn't do without is Emacs's autocomplete. Eclipse's autocomplete is based on syntactical analysis - the code gets parsed, and as you type code you're offered choice of completion. Emacs' autocomplete is base on simple textual analysis. That means it works in plain text, in comments, in documentation - everywhere. I keep saying the Emacs' autocomplete is what IntelliSense wants to be when it grows up.

Update:

Eclipse does offer Alt-/ which is supposed to be similar to Emacs. Not sure how well it works, though.

  • I believe Emacs can also do completion based on a TAGS file (essentially an offline version of the data structure needed for "Go to definition") but I have not experience with the Java version. – Thorbjørn Ravn Andersen Apr 17 '11 at 17:46
1

The only place I prefer an IDE is for debugging. I set up my vim environment for debugging but is was so painful to use, so clunky, that I now just switch to my IDE (Netbeans) when I need to debug. vim is great for text editing, the IDE is great for more complex stuff (like debugging, and some project management related tasks).

rg88
  • 20,742
  • 18
  • 76
  • 110
0

Like some of the posts above, I started out with an IDE (Eclipse). From there I moved to Emacs, and then I moved back to a rich text-editor (TextMate).

For me, the efficiency was the ability to have an editor at the interface level. Allowing me to integrate other service I've built up (or others) into my pseudo-IDE environment.

Rev316
  • 1,920
  • 2
  • 19
  • 24