On Text Editors (Vim & Emacs)

For a software engineer, the code editor is not merely a window where he/she types text; it’s much more than that. A code editor for a coder is like air for a living being, like a tasty dessert for coffee, like a good dog - it’s always there for you. It’s hard to overestimate the importance of a text editing tool when we, developers, spend most of our time using it. The code editor is our primary tool (well, maybe right after the brain). So, let’s talk about it a bit.

Typewriter keyboard

I know some developers don’t make a big deal out of code editors - they just get an IDE from JetBrains or VS Code and happily work forever after. Which is fine - what can be wrong when a tool doesn’t get in your way and just works? Right, nothing. But where’s the fun in that?

Back in the day when I was a junior software engineer, my team lead at that time (hi Yurii) said something like: “If a developer has a task that could take him 1 hour to do manually or he can write a script that could take him 1 hour to write and 1 minute to run - true developers will write a script, even if the script is a one-timer.” I took it to heart. Projecting it onto editors - why should one use a regular editor that “just works” when he can “suffer” a bit and have a much more efficient and present experience later?

What is Available Out There?

Vim and Emacs are two of the most popular choices for “being the coolest kid on the block.” Maybe there are others, but I’m not aware. But those two are enough; I’m not sure the world could handle more, considering the holy war between the two has continued for five decades.

A prerequisite for starting with either of these is, of course, touch typing. One must be “besties” with the keyboard before even thinking about Vim or Emacs.

Both editors propose their own way of thinking about navigating text and the editor itself, as well as customizing the editor. Oh, and regarding customization - it’s not “just an option that is nice to have”… In the world of IDEs, you usually customize a bit, and you’re ready to go. With Vim or Emacs, you’ll have to dive deep into the customization, but it definitely has its dividends later on.

Differences Between VIM and EMACS

The philosophy Vim proposes is different from Emacs. They are both similar in that, based on touch typing, there is a system of navigating text much more comfortably compared with the “standard” way of using arrow keys.

Vim is a text editor with huge possibilities for customization. It can have a built-in terminal and other cool stuff with plugins, but still - in essence, it’s a text editor. Emacs, on the other hand, even though it’s a text editor too, can be much more than that. Many say that it is an operating system - so much can be done there. Emacs, in essence, is a Lisp interpreter (Elisp, which stands for Emacs Lisp, to be precise).

Being a Lisp interpreter at its core turned out to be a solid foundation for the future of the editor. From the moment it was born, it didn’t have a lot of “big rewrites.” Vim’s story is different. First, it was the Vi editor, then it was improved to Vim (Vi Improved), and today we have NeoVim as the most popular Vi implementation. The last one changed its scripting language from Vimscript to Lua. All this means that the initial choices were not as good as in Emacs’ case. Vim’s evolution reminds me of PHP’s journey - first a templating engine, then a bad programming language, then a decent programming language. Emacs is more like JavaScript - perfect from the beginning! Just kidding.

Where Else Do Editors Apply?

So far, I’ve been talking in the context of entirely substituting an IDE with Vim or Emacs. But that is not the only way and not the only benefit. Many popular IDEs have plugins to enable Vim or Emacs mappings, so it becomes possible to navigate text much more efficiently in the environment you’re used to. This approach can either be a transition step (to full substitution) or the final stop.

Even in the case of choosing to just learn the mappings, there are a lot of benefits - Vim comes with all Linux distributions, so knowing it will definitely come in handy. As for Emacs - its keybindings work in the terminal. Check it out right now - type some command in a terminal and try navigating with Ctrl+b and Ctrl+f (the cursor will move by one char); or Alt+b and Alt+f (navigating by words). This is already much more convenient than moving your hand to the arrow keys.

Text is King

Developers write instructions to computers in text. Fiction and non-fiction writers write text. Diagram languages like Mermaid or Graphviz Dot Language are becoming more and more popular. IaaC has been a thing for some time. Most things can be presented in text.

Leonardo Da Vinci used one notebook to write everything. Something came to his mind - he just poured it onto paper. Helicopter idea? Noted! Just heard a delicious soup recipe? Down there, right after the helicopter blueprint. You see - he was a thinker, but not an overthinker. There were a lot of great thinkers who didn’t use Trello or Asana. Take anyone great from before the computer era. Aristotle, for instance - why didn’t he use Asana? Besides the obvious reasons (yeah, it didn’t exist), he might also just not have needed it because plain paper was enough.

Of course, the cool tools available today help organize things and increase productivity. I’m talking about stuff like Trello, Kanbanflow, Todoist, or MS Todo… But still, text is king. Those apps impose some kind of structure on you (which isn’t necessarily a bad thing), but with text, you can shape everything in a much more adaptive way using folders, files, and, most importantly, some system inside the files.

That said, if one chooses to use text heavily, being able to navigate through it effectively helps a lot. It adds to both the convenience and the pleasure of the process.

Final Words

That would be it on the topic. I’ll just add that I use both Vim and Emacs. Vim has been with me for 6 or 7 years already, and for the last couple of months, I’ve been discovering Emacs. Most probably, eventually, I’ll stick to one of them, but it’s fun to explore both. I code solely with Vim, but write any kind of text in Emacs (including this article).

An important thing to note is that no one can get Vim or Emacs in a couple of days. To truly get any of them, it’s required to play with it for at least a couple of months. But it’s definitely worth it.

In any case - I dare you to check out either of the editors. If you’re a developer or write a lot of text, you definitely should check them out.