Why I wouldn’t recommend vim (or emacs) to developers

I promised I would get back on the issue of vim and why I wouldn’t recommend it to anyone, and why (horror, shock, awe!) I find it kind of retrograde. That, importantly, doesn’t mean that everyone is not free to use it, and, to the contrary, people should use it when they are bound to console mode for some reason or another. However… 

In the previous article I made a harsh statement: there is absolutely no reason to learn vim in this day and age. In the small melee that followed, my commentators fought to show me the opposite, and I had two amazing examples that I will embed below. First one with emacs (that has been sided with vim in my rebuttal):

In this example we have emacs orgtbl mode, that will help you arrange a table in the comment part of an HTML file, even precalculate things, in a spreadsheet manner, and then generate the HTML table out of it. However, this is probably not in the common offering of the emacs editor, so it’s „pour les conoisseurs”. That is not its biggest fault though: the main problem here is conceptual: who needs to edit tables in HTML files? Who edits HTML files by hand in this day and age? We’re in the age of generated content and CSS: I find it hard to generate with said tool two types of tables in the same file, and I find it useless to generate tables in HTML files. For a developer this is a breaking point, not a selling point. For anyone else it is proof of loving the 1998-looking web. I am sure it’s useful, but we have more sophisticated tools at hand.

The second one displays the power of vim itself, the named ’evil’. Even if it does pretty much the same thing as above, generating HTML content, it does so in a less intelligent, more appropriate manner:

I call this a more appropriate manner, and I will explain a bit later, however, note one thing: this is about learning a macro and applying it to a set of data. This is not a feature unseen in other editors, however, it has one detail extra: it knows when to stop. Whenever I record such macros in my usual editors I apply them a number of times manually because the editor is not smart enough to understand when the data ends, or where it should end.

This example has all the faults of the previous example, minus ‘it needs to install something amazing that you might not know about’, which makes vim more of an editor than an IDE.

These examples exhibit exactly what the problem with emacs/vi is. The problem is that there are features that you need to know about, and both emacs and vi require you to learn a plethora of shortcuts without any visible cues.

And I come back to the issue of vim being the same as gvim: it’s not. While gvim embeds vim quite nicely, I am still unable to get it on my cygwin distribution. And while Mihai argued that ‘cygwin is fake Linux’, I need to assure everyone that there is absolutely not a single reason why gvim would not run on Windows. Luckily, outside of cygwin gvim has an installation package that will make things work. You know what, surprisingly, works in gvim for Windows?

CTRL-C, CTRL-V. Selection using SHIFT and direction keys. Basic editing functionality, that is.

This is, of course, inconsistent across versions of vim, but it’s an amazing addition. Even the creators of gvim understand the fact that it’s a must to support basic editing functionality, as understood by most people. However, vim lacks on pure Windows the support of the GNU platform. And vim is useless without it.

The UNIX philosophy is to build tons of specialized tools. There is a high degree of flexibility that this philosophy brings, the downside being that you have to know a lot of tools. Sure, there are a lot of smart editing cues in vim itself, but most vim tricks will display some intelligent import from curl, completion done via ctags and other things like that. And some people will need that and some don’t. Most modern developers don’t, because they use an IDE, and I’ll explain some features of an IDE.

But there is always the amount of intelligence an editor can hold. Most editors of an IDE are seen as ‘dumb’ when compared to emacs/vi, because they do little more than editing and completion. vi and emacs are smart. And that’s the problem. The problem is that you have to learn a lot to grow to the level of intelligence your editor has. Vi is a savant, it does amazing things but it’s disconnected from reality.

And the reality is that vi is amazing when you have to type a lot, and generate tons of code. You know what sort of programmers generate tons of code? Mediocre programmers. The goal in modern programming is to generate less code that does smarter things. Efficient developers write 10, 20, 100 lines a day in busy days. And here I come to the place where vi doesn’t stand a chance in the face of an IDE.

While vi and gdb can work together, it’s not as glamorous as Mihai makes it. It just runs gdb in a separate sub-window. It highlights the current line. There is no watch window. There are no key bidings, you have to write stuff by hand in gdb. Here’s a session:

The problem is that most of the stuff that vi ‘can do’, they ‘can be done’. They are not necessarily practical, but they can be done, therefore they are there, the fans say. But the overhead is in fact so big that it’s impractical to anyone but the expert.

My question: Is the time invested in vim worth it? My answer: no, unless you are bound to a console in a way or another. Sure, for Linux server professionals (admins) it makes sense. Even for occasional server admins it makes sense. Does it make sense for the modern developer? Not unless you don’t have a proper IDE. And C++, C# and Java have amazing IDEs that offer a lot of features, including refactoring support, well integrated debuggers, editors well tuned to the needs of your applications (in place graphics editing, or visual editors for UIs, for example). And you also have the space of your editor properly balanced between the needs of the current state: when editing, you can see the project layout, you can also have a find-window without sacrificing too much of your editing space. When debugging, a watch window, more space for code, even split window for following code. And the IDEs keep improving. Integrated git? Even Visual Studio has that, available at right-click on the solution name. The amount of stress on my memory? 0.

While vim glorifies typing, because that’s the only thing that it can do, the rest of editors go beyond 1960 in computing and use a mouse. Certainly, some things are done faster in vi, while a lot of other things are done faster in IDEs. And I cannot find a single reason to use vi over other editor in post Y2K world.

Because in the previous mail I was subjected to vymching (lynching for saying bad things about vi, something that emacs users are accustomed to as well), I will now address the concerns of my unfairness towards vi and to state again that gvim and vim ARE NOT THE SAME SOFTWARE™. They might use similar mechanics, but as gvim for Windows shows it, no, it’s not the same. However, there were other valid concerns that I wanted to address and clarify.

First cmatei’s comment:

So, you want noobs to become experts doing expert stuff, or not ?

If they want to become server administration experts, certainly not. Let them take over the world with vi, since it’s one of the tools of trade. If not, I’d have them off my server. Make them build delivery packages, and shell scripts that will automatically fix the configuration files. Better yet, have the configurations versioned in a git repository, and they can edit with whatever they wish.

Mihai’s concern, aka my bullshit:

there’s no more VT100, everything is emulated.

But vim is thought with the limitations of VTXXX in mind. That’s what the ’text’ in text-mode means. Sure, it’s not driven by the limitations of VTXXX in mind, and it uses graphical mode fully. To display text using monospaced fonts.

There’s no hint in this for newbies being forced to use vim/emacs and terminal

People make such harsh recommendations to beginners. That was my complaint.

«There is no real reason to resort to this sort of painful penitence,» — way to generic to be considered as being only related to newbies

Yes, it refers to everyone. Just because you get to enjoy it, eventually, doesn’t make it less painful. And yes, later I call it ‘crap’, because it is crap. Ask any person having a first contact with vi. Sure, it is smart crap, and it can be used amazingly.

Notice the cursor? Up there? It’s not where you’ll start typing, actually. You’ll start typing in the lowest row, not in the highest row, if you follow the instructions to quit. This is just an example of how counter-intuitive vim is.

Why is vim a piece of crap? While it does the job, it does it like it hates you. The only piece of help you get is that opening text.

If you start editing, and press F1 you get a helpful screen. That doesn’t tell you the basic idiom of vi, which is to press ESC before typing commands like :q!

At this point, the user is overwhelmed. hjkl??? Are you kidding me??? Are you really using hjkl to move around? And I should know that… why?

Most unguided vi users I know quit here.

I understand them.

Vi is a piece of crap because the amount of things you have to learn to use it proficiently have not valid use outside it. While other editors try to find a common ground, that’s not the case with vi. It doesn’t need to, when bound to a console. But that is a cruel limitation for most developers out there.

Proceeding with Mihai’s comments:

«There is absolutely no reason to learn vim in this day and age.» — waaaay too generic

No, it’s a very specific affirmation. Other than the limitation of the console, there’s no reason to learn vim. And that limitation is often self-imposed; you don’t need an XServer to run X applications on a remote display, you need only X libraries installed. There is no security risk. However, remarkably, vim became an amazing tool for administrators. I salute them with all due respect, but developers don’t really need it unless they really really want to.

«you don’t need to fight with the black lacing of the scary terminal. In fact, if your work would ever require starting a terminal, the distributions already failed; » — How is that applicable to newbies in programming? When even QtCreator opens consoles?

You can, you are not forced to.

The rest of his comments were towards my mean parallel that vim is worse than Notepad. In some sense, it is. Especially when it comes to those people that quit when seeing the help screen. Of course I was augmenting the suckiness of vim by putting it side by side with Notepad, an editor it will never beat at intuitivity.

Not to beat vim too much, I do recommended where a lot of typing is involved. Not a book, editing text is crappy with vim, and it doesn’t really help there, but when you edit config files, HTML files, etc. it’s a fast alternative to any other editor. It is a nice tool, a cool gimmick, and it can do a ton of things.

Too bad its fans are such a lynching bunch. We could hear less spite, and more interesting things about it.

But the dialogue is driven by spite. I write a spiteful article towards vim and I’m answered with spite, mostly because there are no arguments. I loved cmatei’s mature intervention because it showed real cases of stuff done faster and better. Yet I don’t think it’s a reason to recommend the editor to beginners for that alone, this kind of arguments need to be brought up, not attacking flame with flame.

This article is inflammatory, I know. I will do something special for this article. From each commenter I will censor ALL comments beyond the first one, and I will answer to each such comment, without the possibility to be answered back. I do this to stop any flame from burning, because it’s my blog, and because I want the answers and possible questions to be well thought through. This is my opinion on the matter, I put a few days of reflection behind it and I am more than happy to explain why I said things I said.

And I am more than happy to note any feature that vim has and no other editor has. Other than console mode.

And please, pay attention. I said vim is crap, but said nothing on the developers or other professionals that use it. I never insult someone’s way to work, especially if that way is efficient for them. And vim can be very efficient once you know it.

Ladies and gentlemen, you have one comment. Thank you for your patronage.