Programmer Productivity: Emacs versus IntelliJ IDEA

For seven years I coded in C++ using Emacs. Four years ago, when I changed jobs, I switched to Java development using IntelliJ IDEA. Without a doubt, I am much more productive writing code in IntelliJ IDEA compared to using Emacs. Here’s why:


Coding is really something like 80% navigation, and only 20% actual writing, and where IntelliJ IDEA really shines is navigating the code base. For instance, say you want to add functionality to an existing class. Even if you know the class well, you need to check where the new code would fit in. Do you need to add a new state? What other classes are using the method you need to modify? These all require navigating the existing code.

Even when you write code there is a lot of navigation. What is the name of that method you want to use? What is the order of the arguments – is it a string first, and then an integer, or the other way around? What are the possible values of that enum?

Some of the navigation is within a file. The most common things I do within a file are: jump to the top/bottom of it, jump to the beginning/end of a line, select text, cut, copy, paste, search (incrementally) backwards and forwards, and commenting and un-commenting code. Both Emacs and IntelliJ IDEA have good commands and keybindings for all these operations.

But when it comes to navigating between files, IntelliJ IDEA has a big advantage. One of the most useful commands is Ctrl + B (go to declaration). As the name implies, you jump to where the variable, method or class is declared, even if it is in another file. Ctrl + Alt + Left takes you back. I use this all the time, often jumping several levels down before returning back to where I started.

A related navigation command is Ctrl + Alt + B, (Go to implementation). Use this command at the method name of an interface, and you get a pop-up list of all the places where this method is implemented, and you can select which one you want to go to (if there is only one implementation, you go straight there). The same goes for overridden methods.

The opposite of this is Ctrl + U (Go to super-method/super-class). If the caret is at the implementation of a method in an interface (shown by a little interface-symbol to the left of the method name), this command takes you to the interface itself.

When I want to see all the places where a method or variable is used (which I want to do a lot), I use Ctrl + Alt + F7 (Show usages). This gives you a pop-up list of all the usages, and you can easily navigate to each one. To find classes, I use Ctrl + N (Go to class), which lets you search using only the capital letters in the class name (“camel humps”), and * as wildcard. I also use ctrl + E a lot. It brings up a pop-up window of the 15 most recently used files (most recently used is at the top), and you just arrow down to that one you want and hit enter to navigate to it.

Yet another useful command is Ctrl + P (Parameter info). Use it at the arguments of methods and constructors to get a pop-up showing the types and names of the parameters, and where in the list you are. While this is not navigation in one sense, it would be in Emacs, since you would have to go to the file where the method or constructor is defined in order to find this information.

All of the above navigational commands are incredible time-savers.  In Emacs you need to switch to the file yourself in order to find what you look for. In IntelliJ IDEA it’s automatic. In fact, I noticed that in my C++ and Emacs days, my classes tended to be bigger, and my methods fewer and longer compared to in Java. I think a reason for this is that navigation was easier when it was all in one file, but with the powerful navigation in IntelliJ IDEA it doesn’t matter much if functionality is spread out over several files.

Other Advantages

Navigation aside, there are many other areas where IntelliJ IDEA has an edge. While both environments have syntax highlighting, IntelliJ IDEA has added a few useful features. Static methods and variables are shown in italics. Unused variables, methods or imports are greyed out. And of course IntelliJ IDEA will mark in red anything that is not syntactically correct as you type it. No need anymore to compile just to check the syntax – it’s done in real time for you.

IntelliJ IDEA also has some very useful features when actually writing code. First among those is auto-completion of names. Type a few letters of a variable or method name, hit Ctrl + space, and the name is expanded. Or use it to see what methods are available on an object by pressing Ctrl + space after the dot.

Another feature, which, according to the cool IntelliJ IDEA usage statistics, is the single feature I use the most, is syntax aware selection. If you press Ctrl + W repeatedly, it will select a bigger and bigger section of the code. For example, it can select a method name, then then expression, then the whole statement, then the containing block. Very useful when searching, indenting, commenting-out code etc.

And of course, there is refactoring support. In Emacs, if I wanted to change a method name, I would do a search and replace. But for each replace, I had to check to make sure I wasn’t accidentally changing something that shouldn’t be changed. If the method was public, I had to find all occurrences in other classes as well. In IntellJ IDEA, it’s a snap. Just select the method name, press Ctrl + F6, type the new name and hit enter. All occurrences in all files are replaced.

Unfounded Concerns about IDE:s

I often see comments about how if you’re using an IDE, you must be using the mouse and menus a lot. This is simply wrong. I love keyboard shortcuts in all applications, and I do as much as I can without reaching for the mouse. IntelliJ IDEA has great keybindings for almost all commands, and it’s easy to add new ones or modify existing ones. So there are really not a lot situations where you need to use the mouse and menus. All the commands I mentioned above I access with keyboard shortcuts.

Another unfounded concern is that you will only be able to do what is listed in the menus of the IDE. This too is an argument that doesn’t hold up. In my case, I do exactly what I did in Emacs, namely writing and editing code. The only difference is that it is a lot faster and more accurate in IntelliJ IDEA.

There is also a general unease that you’ll be “forced into the closed environment” of the IDE. Well, nothing stops you from using other tools when needed. The source tree is still there. Exit the IDE and use whatever tools you need, then get back in again. For example, I’ll sometimes need to grep through code that spans several IntelliJ IDEA projects. In those cases, I’ll just use grep with a suitable reg exp. No big deal.

Finally, I have seen the argument that the IDE adds configuration and meta-data files all over. In the IntellJ IDEA case, there are only 3 project files added at the root of the source tree. That’s it. Very unobtrusive.

You don’t know what you are missing…

The funny thing is, before I switched I was very happy using Emacs. I had learnt a lot of short cuts, and I had become really good at editing. I was also good at using grep, find and other Unix commands on the source tree, and didn’t feel that I lacked any tools. Quick side-note: the best source for Unix command line tools is Unix Power Tools. Pure gold on the command line.

When I started at Symsoft, pretty much all developers were using IntelliJ IDEA, so it was only natural to try it out. I quickly saw what you could do with it, and never looked back. In fact, once I realized all the cool things it could do, I insisted on showing my former coworkers what it could do. Whenever I had lunch with one of them, I would bring them up to my office and show them some of IntelliJ IDEA’s tricks. Seeing is believing.

…but there is always room for a good editor

There is always room for a good text editor. Even though I don’t use Emacs for Java, I still use Emacs pretty much every day.  It’s my editor of choice for text files, and I use it for the occasional bash and ruby scripts.

However, just the other day, the subject of text editors came up with a colleague of mine. He mentioned that he had just started to learn Vim. In the spirit of making sure I know what I’m missing, I will give it a try too. So for a while now, I’ll replace Emacs with Vim. Let’s see how that turns out.

40 responses to “Programmer Productivity: Emacs versus IntelliJ IDEA

  1. FWIW, in emacs, M-. is jump to definition, M-* returns you.

  2. If you primarily code in a single language, agreed that sometimes a specific IDE might work out better. However, I think all or at least most of the ‘advantages’ that you describe here for IntellJIDEA are possible in emacs also. For example, the syntax aware selection you describe is, if I am not mistaken, the same as expand-region in emacs (

    • Thanks for the tip Raja. I tried using more IDE-like features in Emacs, but none worked very well (and some you had to cobble together yourself). Granted, that was several years ago, so they may be much better now.

      However, I still think some features, like global refactoring (across files) of a method name are hard to get in Emacs, since they basically require parsing the program to know what occurrences to replace. But I would be happy to be proven wrong on this, since it is such a useful feature.

      Also, in my case I do most of my coding in Java, so it is appropriate to concentrate in one IDE. But like I wrote, you always need a good text editor anyway.

      • Refactoring support in emacs varies a lot, depending on the language. For javascript, js2-mode gives great refactoring. For python, see rope. I tend to avoid java so can’t really speak for emacs support there..

  3. You should try Sublime Text 2 for Text Editors

  4. I was also an Emacs user before getting a Java job. I tried to use Eclipse, NetBeans and Idea. I really did. I wanted the refactoring tools that came with them. However, I found I’d rather suffer their lack than try and deal with the terrible text editors that come with those IDEs. I found it easier to get a tags file, and flymake working than to get any of them to integrate well with an external editor. I’m now a Clojure developer, so I guess that I’ve solved that problem in another way 😉 Either way, I’m glad your life has improved with the change.

  5. If there is an option or menu you would like to access in IDEA but don’t remember the shortcut you can also search through menus and options using CMD+SHIFT+A (On a Mac) – if it translates to windows key bindings like most other bindings in Mac IDEA I guess it will be CTRL+SHIFT+A for you.
    You can also use templates in IDEA – again on the Mac the shortcut is CMD+J – so I guess that is CTRL+J on Windows. Templates are shortcuts to frequently used code blocks – like try/catch – iteration, instanceof with subsequent downcast etc. etc. – you can also define your own templates, and share them between your team members to get more similar style of code.

    • …almost forgot

      Another handy shortcut is that you don’t need to leave the class or method you are writing in order to see the implementation details of fields/constants or methods you are calling from that method. Place your cursor on the call, and hit CMD+SHIFT+I (on a Mac), to have a peek at the implementation. Maybe CTRL+SHIFT+I on Windows?

  6. Totally agree with your assessment of IDEs and editors. (Intellij IDEA in particular). I’ve recently switched editors to Sublime Text also, after various amounts of time with SlickEdit, vim and Emacs. Sublime is a joy, reminds me of when I first started with IDEA in 2003.

    • Hi John,
      Thanks for your comment. I’ve actually heard many people recommend Sublime Text, so I’ll have to give it a try.

      • I tried out Sublime, and I have enjoyed many of its features. The fact that it does not have good macro support is unfortunate, however.

        On the other hand, one of the pain points with using emacs is configuring it to fit in with the other programs you use. Whether its Windows, OSX, or even some distros of LInux, I find it somewhat a chore to configure it to play along nicely so I don’t have to remember two keyboard commands for cut-and-paste.

        Because we all know those the most important commands… 😉

  7. You should have spend some time learning Emacs. Emacs can jump to definitions. There is e/ctags, JDEE, CEDET, and other stuff. And Emacs is an IDE to begin with.

    • Yes, I totally missed e/ctags – would have been good to try. I tried some IDE package that I have forgotten the name of, but it didn’t work very well. Anyway, for Java I’m very productive using IntelliJ IDEA, so I’ll stick with that.

  8. There is even an Eclipse stuff for vim and Emacs thing called eclim.

  9. You should change the title of your article to “JAVA Programmer Productivity: Emacs versus IntelliJ IDEA”

    For millions of programmer who use other languages (c#, vb, c, c++, python, ruby, php, perl, haskell, f#, common lisp, scheme, scala) your article does not make any sense. You simply writing them off as if they do not exist.

    • I haven’t tried IntelliJ IDEA for other languages, but according to their site, it also supports Groovy, JavaScript, Ruby, PHP and Scala.

    • The title is more correct than narrowly specifying Java. Your comment makes me question whether you really know the other languages.

      1) You wouldn’t write C# or VB or F# in emacs or IntelliJ, you’d use VS because its the absolute best tool for those languages, bar none. (And that’s coming from someone who was very happy to move away from Windows development.)

      2) I currently use IntelliJ for Scala, and its the auto-complete/intellisense is a critical feature. IntelliJ will show you methods that come from implicit conversions, and that’s critical to finding the best way to solve the problem. I worked with a guy who used emacs (and really knew it) but the code he created suffered, even compared to less able developers using IntelliJ.

    • Because none of those languages require navigating around a file-based code base? Look, had I written a similar article I would’ve titled it ‘cool eclipse refactorings’ and it would genuinely ignore non-java programmers (many of whom seem to think getting an IDE to do work for you is cheating), but one could hardly accuse this article of that.

  10. The small gains some IDEs give you will never surpass the gains you get when you learn a language agnostic editor such as Vim.

  11. Other advantages refactoring!!?!! Come on! I´m stuck at work with vim/c++ and I would kill for proper refactoring!!!! Relly nice article! 😉

  12. You might have already finished your Vim experiment, but you might try using “viper-mode” in emacs or xemacs. I used level 4 emulation in viper-mode in xemacs. It gives you the best of both worlds emacs / vim.

  13. Ettore Pellicani

    Very interext the after experience and also developement . Y’me like engeener’s and new performer’s into the systemes for navigation and communication or applications fully mode and multi operative language (bi sys-tersys-qadsys) and autocode mode definition. Uniformer the sample opensource in the evolutive aggregation and immediate usage. Sorry my engles, y’me Italian country whit franch language in work . Tanke a lot and regard distintly for you.

  14. It doesn’t need to be Eclipse/IntelliJ vs Emacs/vim. I do use both an IDE and a powerful “text editor” to work on the same project. Smart vim users did develop “eclim”: a server mode for Eclipse that they then connect to from vim. Then smart Emacs users did write emacs-eclim, which reuses eclim but, this time, from Emacs.

    Doing that you get auto-completion, inspections, navigation, etc. all from vim/Emacs.

    Doing that the IDE doesn’t go away: it’s still there, doing its job. But now one can use a real text editor (like Emacs or vim) and not be stuck with the overly lame and pathetic text editors IDEs do provide.

    Honestly there’s no way any IDE is offering a text editor coming anywhere near close what vim/Emacs are capable of.

    Concerning precisely Emacs: there’s no way any IDE shall ever rewrite the one million lines of Lisp code nor all the great modes that Emacs has. So you better jump ship as soon as you can because you’ll never ever see an IDE offering a text editor as good as Emacs.

    On the contrary, having Emacs allowing to use an IDE’s feature: we’re already 90% there and it’s only going to get better…

  15. Pingback: JetBrains builds on Google Android collaboration for new IntelliJ IDEA » Nottingham PC Repair

  16. Pingback: JetBrains builds on Google Android collaboration for new IntelliJ IDEA | PR Media @ Web Design Puerto Rico

  17. I love your blog.. very nice colors & theme. Did you create this website
    yourself or did you hire someone to do it for you?
    Plz reply as I’m looking to design my own blog and would like to find out where u
    got this from. cheers

  18. I love Emacs because I’m already master of IDEs (13 years), yes all those code navigation, auto-complete tricks, hot key tricks.

    I have answered similar questions to Emacs newbies many times:
    1. If you are only on specific eco-system, you *should* use IDE, because IDE is optimized for that eco-system. Especially in enterprise application development. So you should use Visual Studio doing .NET and IntelliJ when doing Java stuff.

    2. Emacs’s strength is that in top geeks’ hands it can do anything. but it needs you spend time to set up.

    3. IDE has optimized the set up for you. but it’s also finalized set up. You productivity has upper limit set by IDE.

    4. When you master everything of IDE, you will turn to Emacs some day.

    5. In your example, I have to say you should’t use Emacs to do C++ development for seven years unless you have no choice because only recently Emacs begins to have some decent advanced IDE eatures. I always use Visual Studio or QT Creator (any top IDEs) to do the C++ development, or 13 years.

    6. but I also realized the potential of Emacs and have done lots of work to make Emacs close to those IDEs on intellisense, code navigtation ( So the key point is what I can do for Emacs?

    7. Code navigation, intellisense are close to IDE now because of hard work from many emacs geeks, me incldued)

    8. Especially in text editing (Emacs is a text editor, right?), Emacs is the best one in the world.

  19. Pingback: 程序员的工作效率:Emacs vs IntelliJ IDEA | 我爱互联网

  20. Then, this is a story about using emacs as notepad in 7 years?

  21. hi,I remember Shift+F6 will change the name of the method,and Ctrl+F6 is to change the method signature.

  22. Great information. Lucky me I discovered your site by accident (stumbleupon).
    I have saved as a favorite for later!

  23. I’ve been using emacs heavily for 28 years. In addition to being the best text editor, its shell integration features and keyboard macros make it completely indispensable for my day-to-day work. Having multiple shell buffers, ephemeral shells for throwaway commands, the ability to pipe a buffer region through a sequence of awk/sed/etc, manipulating files with dired, M-x find, M-x grep and so on are all things I use daily. Text transformations that would take a 10 line Python script are often a few keystrokes of keyboard macro, recorded in seconds.

    Remember, emacs is not a text editor. It’s a LISP machine disguised as a text editor. 🙂

    That said, after years of trying and hating IDEs, including earlier versions of IntelliJ, I’ve switched to using the two together for Java. I set up a keybinding in IntelliJ to open the current file using emacsclient. I use IntelliJ’s excellent and fast code navigation to get around my code and debug Java (JDE is ok, but IntelliJ’s debugger integration is better). And every time I want to enter more than 10 characters of text I hit C-x e and I’m in emacs. Cmd-tab back to IntelliJ and it has reloaded my changes. Yay!

    Best of both worlds.

  24. Henrik, as a great lisp programmer I expect from you to contribute to extend emacs with IDE like functionality instead of moving from a emacs (a lisp machine).

  25. Pingback: Java ist nicht tot, danke der Nachfrage! - JAXenter

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s