Should You Learn a Powerful Editor like Vim or Emacs?

Should You Learn a Powerful Editor like Vim or Emacs?

You’ve probably heard of them. They’re the text editors that real programmers use. The powerful tools that will boost your productivity into outer space if you can ever master them.

I’m talking about Emacs and Vim.

Perhaps that isn’t the way you’ve seen these two text editors presented, but when I first heard about them, I had this perception that I absolutely had to use them if I wanted to be a cool and competent programmer. They were said to have a huge learning curve yet to offer equivalently incredible editing power. I had to learn how to use at least one of them!

So are these editors worth the learning investment they present?

First, a disclaimer: I have never used Emacs, so I won’t comment on it yay or nay. Additionally, I have been playing with Vim for only the last three or four years.

I am not a Vim master by any means — but that kind of serves to aid my argument, which is that an editor as complex as Vim, although incredibly powerful, may not be the right choice for you right now, especially if you are at all new to programming.

Now, before I describe why I think you might choose to avoid Vim, I want you to take a step back and evaluate your typing skills.

What’s that? You say that you asked for advice on a text editor, not an exhortation to practice touch typing?

Ask yourself a few of the following questions:

  • Would you benefit from greater accuracy or speed when typing?
  • Can you consistently type numbers on the number row?
  • Do you know where all of the brackets, braces, and other symbols are on your keyboard without looking at it?

Fancy features are all well and good, but typing is a universally helpful skill that will benefit just about any digital activity you do. Before you jump headlong into an editor like Vim or Emacs, make sure that your command of the keyboard is up to snuff. If you aren’t convinced that typing is vital to your skill as a programmer, check out this article by Jeff Attwood. His post is one of the reasons I started this blog.

Why you shouldn’t use Vim

The most obvious scenario I can think of that would make Vim a bad idea for you is if you are new to programming. When you are learning something new, you want as few obstacles as possible to get in your way. Despite what anyone says to the contrary, programming can be hard when you are just starting out. Don’t make it any harder. As an example of how Vim could be an obstacle, consider that the “simple” act of exiting Vim is so un-intuitive that it has become an internet joke.

If you are still learning the syntax of your programming language, if you don’t quite know what makes a class different than an object, if you aren’t sure how polymorphism affects the outcome of a method call, etc., then do yourself a favor and wait until you have a firm grasp of the basics before complicating matters with a tricky text editor.

Secondly, Vim is a light weight editor compared to an IDE like Visual Studio Code. While this can be a good thing, it also means that Vim doesn’t offer any autocompletion, debugging, or refactoring features out-of-the-box. Some of these niceties can be added to Vim via plugins and configuration scripts, but a newer programmer might benefit more from an IDE, which is intended solely for writing code, than from a general purpose text editor like Vim.

Thirdly, Vim has so many neat features that you might get overwhelmed configuring it! This argument is certainly a stretch, but if you are like me, then you may be tempted to go off of the deep end into tweaking and customizing Vim. There is nothing wrong with tinkering around and tailoring Vim to suit your needs and desires, but if your goal is to actually get to the act of writing code, then the sheer number of configuration options in Vim might distract you from finishing your project.

Fourthly, your time may be better spent learning other skills. I’ve already mentioned that I believe typing to be foundational to programming, but there are other good things to know how to do. For instance, at the heart of programming is problem solving. If you are weak on devising solutions for tasks, consider attempting a few challenge problems from Kattis. Another skill that I would prioritize over Vim is version control. If you are not familiar with Git, it is a tool that tracks the changes you make to your code files over time, taking little snapshots of your project, then allowing you to view and undo those changes any time. Version control is borderline essential for any sizable project, so it’s well worth taking the time to learn.

Finally, by learning Vim you also risk becoming a text editor snob. Symptoms of snobbiness may include:

  • claiming that real programmers don’t rely on autocomplete
  • complaining about having to use any tool other than Vim
  • telling others that they would be better programmers if they used Vim

But you should learn Vim eventually

These cautions against using Vim stem from an assumption that you are fairly new to programming. If you already know what you are doing, however, I think Vim is definitely worth a try. Vim’s complexity arises in part because it has something called “command” mode, which is separate from its normal “insert” mode. In command mode, pressing a letter key doesn’t cause that letter to appear in the document. Instead, that letter (and each of the others) acts as a shortcut or hotkey. With a whole alphabet of hotkey buttons available via command mode, Vim can offer very specific cursor navigation (from word to word or opening parenthesis to closing parenthesis, for example), which makes it possible to perform intricate text operations with very few keystrokes. The Vim community has even made a competition called VimGolf out of their fanaticism for efficiency.

Vim is a deep well of productivity-boosting elixir, but it takes time to draw it out.

Leave a Reply

Your email address will not be published. Required fields are marked *