Why I started using emacs (and why you shouldn’t)
In what feels like a long time ago, I – as the curious software engineer that I am – began a journey. I had decided to try vim (“wha…? It said emacs in the title… is this the right art…” — yes it is, just keep on reading). It’d always baffled me why would people use such a barebones editor over a proper IDE but I figured, if so many people were using it and following it almost as a cult, there must be something to it. So I sat down and forced myself to learn some basics to get me started. And, of course, I started by learning how to quit the editor (relevant side joke: Q: How do you generate a random string? A: Put a Windows user in front of vi, and tell them to exit.), learned about the different modes and I learned basic things like moving forwards and backwards by units of words, and how to delete multiple lines and how to go to a certain line, etc. Basically the kind of thing I would be faced with whilst using vim to actually achieve something programming-wise.
[Continue Reading]
And it was glorious.
The muscle memory started forming and it became second nature. Vim became part of my tool belt and, when it came to editing files, I started to use it for everything. Delete lines in bulk? Got it. Search and replace the whole document with regular expressions? Piece of cake. Moving around the document by using search rather than painstakingly scrolling my way to it? Hell yeah.
As part of my vim usage, I also created a very small .vimrc which loaded some basic plugins and set the tabbing policies to something sensible (spaces master race!), but that was it, and all was well.
Then one day, I woke up and thought: “heh, it’s funny, I’ve heard about the editor war but I never really took the time to see what’s on the other side of the fence” and so I decided to climb the fence and have a quick peek. I equipped myself with emacs and, again, forced myself to go through the same bootcamp I had forced myself to years earlier with vim. Not only did I do the same thing, but because my muscle memory was already developed around vim, I started noting down the key combinations for the most common things I was doing in vim, except this time in emacs.
Editor-wise, I didn’t feel much difference in productivity. It was when I started exploring the different plugins and available customizations that I got really hooked. You see, emacs has its equivalent of the .vimrc file, the init.el. Here is where you can load plugins and set configuration variables to be loaded on emacs’ startup. While in the process of trying to customize emacs to behave the same way my vim was behaving with regards to tabbing and directory explorer (I was using NERDTree) I found out how that in emacs you can simply set up MELPA, emacs’ package repository, and install everything through it. Emacs has its own package repository. Mind blown. Every single mainstream plugin is available at the distance of Alt + X (M-x in emacs notation), writing package-install, and then typing the name of the package. It’s like your editor has its own version of apt-get.
Since this exotic new editor (which contrary to vim is always in edit mode) was allowing me to discover, install and configure a whole range of plugins through a package repository, I started installing and configuring. That’s when mind blown #2 came. To load and configure this plugins via the init.el file I was writing elisp code. That’s right, emacs is built around elisp, its own dialect of a functional programming lisp language. I’d never done any functional programming before, but damn, I was enjoying it thoroughly. I’d never done any Vimscript before but I’d heard horror stories about it, and elisp, by opposition, was being a walk in a very pleasant park with a warm breeze flowing through.
After all was said and done, and after gradually (over the course of days) customizing my init.el to my liking, my emacs was looking no different than a fancy Atom or Sublime Text. Below you’ll find a comparison of what emacs looks like out of the box (courtesy of GNU) and what my emacs looks like sporting the monokai theme:
Now, a few weeks later, I look back and I think I would have done it all the same. However, beware, don’t get into emacs unless you really have the time to spare to have a whole new world opened to you. Are you already a functional programming guru? Then step right ahead, you’ll feel right at home with emacs. Otherwise, you’ll find yourself discovering more than an editor. Emacs was once jokingly defined as a “great operating system, lacking only a decent editor”. I disagree. It is an operating system, but the editor itself is awesome and kicks vim out of the park any time. By the way, did I mention that vim was implemented within emacs? You will be able to use your tested and tried vim experience with all the goodness of emacs. What’s more to want?
Have fun with emacs and tell me about your experiences in the comments section below. Until the next time.
Comments