The tale of why I chose Vim over Emacs and any IDE.

Some month ago I watched someone hacking pretty impressive with Emacs . It was so fast I did not even get what he actually was doing. That day I decided to master Emacs to become as productive as he was. Some weeks passed and it started to feel really good. Until some friends at university told me they prefer vim. At first I thought something like “What’s this with the crazy mode stuff? Where is my C-x M-c M-butterfly?”. But once you get used to vim you will never miss it again. I made the switch and I am very happy. In this blog post I will clarify the reasons for my decision and introduce some resources that helped me getting up to speed. 

Why no IDE?

For those who are asking themselves “Why doesn’t this nuthead just use one of awesome pwnage IDE’s out there?” I will provide a short explanation why IDEs suck in my humble opinion.

I first thought about this while reading The Pragmatic Programmer. Andy Hunt and Dave Thomas argue that plain text is the material a programmer works with, so he should choose one tool and master it. With a text editor you could do nearly everything, you can code, write documentation, write emails or do simple system administration. Even shells support some bindings from vi and Emacs. It would be very painful to have a different tool for each of these task and hence having to remember lots of shortcuts for the same operations. It feels just awesome and productive to have one tool for all the jobs.

Another point is, that I do not like IDEs trying to be smarter as I am. Imagine you want to teach someone Java and start out with Eclipse. He will write some code, press run and be happy. But he will never know what’s exactly going on in the background. If you do your compilation and such things on your own, you will be able to do it everywhere. If your IDE does all the magic it can happen that you have to deal with weird problems if you have to work in another environment with different configuration. It’s really a pain in the ass to manage your IDE configuration across different environments.

Some people probably will stand up now and shout “But what is about my IDEs kickass-features like auto-completion, auto-indentation, refactoring and such things?”. Because of the extensibility of text editors it’s easy to enhance it with this features if you need to have them. Have you ever tried to add something to Eclipse? I tried once and gave up after reading through some documentation how to do this. Apart from this there are the awesome Unix tools like grep, find, sed, ack etc., that can be integrated into Vim or used along with it to perform some complex tasks.

Last but not least a text editor is more portable. You just have to drop your .vim directory and your .vimrc into your home directory and you have exactly the same configuration like everywhere else. Personally I keep my vim-files at github, to be able to access them from everywhere.

Why I think Vim > Emacs

Before I start telling you why vim is awesome, I would like to say that everybody should use the text editor he likes most as long as one is happy with it. But do not just stick with the one you started with because you are used to it. That’s exactly what I did with Emacs. Keep your mind open and give the alternative a serious try. If you stick with your first choice after this that’s absolutely fine, but if not you will be very happy about every minute you invested in your investigation.

The following points are just my subjective thoughts about this, no offense!

?Modes

The fact that Emacs has just a single mode may be familiar at first because that’s the way of writing text we are used to. But just think about for a moment, what you are actually doing all the time. First of all you are writing text of course. But it turns out you are spending much more time moving written text around or tweaking it to fit some new requirements. In my opinion it is much more intuitive to have different modes for different kinds of actions. If you have modes, you can use the same shortcuts for different operations in different modes and this reduces the overall amount keys you have to pres a lot. In Vim you perfectly can get through with numbers, letters and ESC. In Emacs you have to press CTRL and ALT for everything. This is very annoying in my opinion.

Customization

Personally I don’t like elisp. After weeks staring at it I still had no clue how this exactly works and find it just weird. When I started with vim I looked over some vimscripts and immediately got an idea of what they were doing and how to use them. If you don’t already know lisp you probably like vimscript much more.

Startup time

Some one told me once “Emacs is a nice operating system, but it lacks a good text editor.”. Firing up Emacs for a quick edit was very annoying as it takes ages to load with all the plugins I installed. Of course one could not load them by default but loading them up manually is very annoying and wasn’t able to find something easy like the vim-filetype-detection hooks. My vim is up and running immediately, even with everything loaded by default. Feels so much better!

Vim is everywhere

Vim is pre-installed in nearly every *NIX based system. Emacs is not, you have to install it manually. This is no problem until you e.g. have to work remotely on a machine through ssh without the permissions to install anything.

Resources to start with vim

The first thing you should do is starting the vimtutor that comes with vim. Just open a terminal, type vimtutor and follow the given instructions. He will teach you the basics like movement, opening and saving files and how to use the different modes of vim. It feels very strange at the beginning but once you are used to it, it feels strange and uncomfortable to use arrow keys or even the mouse.

If you aren’t very good at memorizing things, the next thing you should look out for is a good cheat sheet with the most important commands. I find this one very useful. But there are plenty on the web, just google around for vim cheat sheet and choose the one you like most.

Another very useful tool is the built-in help system. Just open your vim and type :help in command mode. This help system has a lot to offer, a detailed introduction on how to use it can be found here.?

Here is a list of some useful resources for further reading:

What’s next?

To get used to editing with Vim you should try to use it for every text editing task you encounter. Vim is learning by doing. Everytime you want to do something you should google around and find the vim-way of doing it. Over time you will gain a lot of experience and soon someone standing behind you watching you code will thing you are an amazing hacker. :P

This is just the first post of a never-ending series on how to be as efficient as possible with Vim. The next post will probably introduce the plugin bundle I am using, followed by some more posts with tutorials on how to use the provided plugins.

Stay tuned!

  • http://www.fancy-lang.org Christopher Bertels

    Cool, I use vim for remote work too (unless there’s a emacs installed of course) – but yeah. Your points do make sense but I just prefer Emacs over vim for longer writing tasks like coding. And since I know lisp Elisp doesn’t look that scary too me either ;)
    In the end it’s all about what feels most natural to you anyway.

  • http://www.fancy-lang.org Christopher Bertels

    Cool, I use vim for remote work too (unless there’s a emacs installed of course) – but yeah. Your points do make sense but I just prefer Emacs over vim for longer writing tasks like coding. And since I know lisp Elisp doesn’t look that scary too me either ;)
    In the end it’s all about what feels most natural to you anyway.

  • gast

    Na ja, dein Englisch ist aber nicht das beste, hier und da kleine Fehler, sehr “deutschtypisch” dein Satzbau und deine Wortwahl. Schreib doch besser auf Deutsch.

    • Anonymous

      Nun ja, in der Tat ist mir das bereits bekannt. Genau das ist ja der Grund, aus dem ich auf englisch schreibe. Übung macht den Meister, ne? Ich nehme gerne konkrete Verbesserungsvorschläge entgegen. :)

  • gast

    Na ja, dein Englisch ist aber nicht das beste, hier und da kleine Fehler, sehr “deutschtypisch” dein Satzbau und deine Wortwahl. Schreib doch besser auf Deutsch.

    • http://www.nils-haldenwang.de NilsHaldenwang

      Nun ja, in der Tat ist mir das bereits bekannt. Genau das ist ja der Grund, aus dem ich auf englisch schreibe. Übung macht den Meister, ne? Ich nehme gerne konkrete Verbesserungsvorschläge entgegen. :)

  • Gäst

    Ok, you just inspired me to give it a third try…

  • Gäst

    Ok, you just inspired me to give it a third try…

  • Meme

    Cool story bro.

  • Meme

    Cool story bro.

  • http://GottZ.de Jan-Stefan Janetzky

    ich mag züge!

    .. und vim natürlich :D

    • Anonymous

      Guter Hinweis, danke. Schade drum, war ein gutes Cheatsheet.

  • http://GottZ.de/ Jan-Stefan Janetzky (@iGottZ)

    ich mag züge!

    .. und vim natürlich :D

    btw ist der link des 2. cheat sheets im eimer.

    • http://www.nils-haldenwang.de NilsHaldenwang

      Guter Hinweis, danke. Schade drum, war ein gutes Cheatsheet.

  • Emil Asmussen

    Ausgezeichneter Artikel … stimme vollkommen mit Dir überein … Abhängigkeit von IDE etc. und womöglich noch propietär … schrecklich, wer was kann, sollte das überall können … unabhängig von der Arbeitsumgebung … darüber hinaus sind Konsole/Vim für die Arbeit auf Servern unerlässlich … Dein englisch neide ich Dir … Gruß Emil

  • Emil Asmussen

    Ausgezeichneter Artikel … stimme vollkommen mit Dir überein … Abhängigkeit von IDE etc. und womöglich noch propietär … schrecklich, wer was kann, sollte das überall können … unabhängig von der Arbeitsumgebung … darüber hinaus sind Konsole/Vim für die Arbeit auf Servern unerlässlich … Dein englisch neide ich Dir … Gruß Emil

  • Roth

    ???????????vim????????emacs???????????????vim?emacs?????????????????emacs????

  • Roth

    受益匪浅,但理由感觉是vim比较容易深入,比emacs更符合人们的下意识。但是如果把vim和emacs用到极致,各自体现其精华时,我感觉emacs更合适。