Skip to content

[Emacs] I'm a turncoat

September 29, 2023 | 11:05 PM

20 years in Vim, and it all fell apart when I started looking at Clojure. I’m mostly kidding. I’ll explain what piqued my interest, what drew me in deeper, and then what ultimately convinced me to stick with it.

Table of contents

Open Table of contents

The before times

Like most of us, when I first discovered Linux, I too got stuck in vi and freaked out. It wasn’t until my first job as a software developer 👶🏻 until I really understood what it was all about. At that point I had been using Visual Studio, Eclipse, and Anjunta (anyone remember this one?).

Thinking about it in retrospect, I don’t think I regret that progression. While Vim is an infinitely better text editor, I can’t imagine trying to learn to program in it without the visual debuggers these IDEs offered. My bias toward that means of learning would likely result in me directing inexperienced developers to an IDE well before I even mention such powerful and archaic tools.

An era of Vim

When I finally did manage to trip into Vim at the very start of my professional career, I was in a good place to take on that challenge. I had a very strong foundation in C/C++, I had spent the prior 6 or so years playing around in Linux. So I knew enough to get my job done, while also feeling ready for the next challenge. This is the sweet spot for picking up new things. I would caution new developers from overloading their plate by trying to code like the “influencers”. Go at your own pace and don’t prematurely optimize (your workflow).

I spent weeks, months maybe 😰, watching pre-YouTube tutorial videos until I was comfortable bringing it to work. Even still, Vim was a very narrowly focused tool at the time, there were probably some plugins back then that could have been helpful, but they weren’t nearly as ubiquitous as they are today. In the modern era of Vim, you can absolutely do everything you need to do as a programmer, in concernt with some supplemental CLI tools.

The Vim vs Emacs war

The sad thing is, the on-going joke of Vim > Emacs > Vim was prevalent throughout my career, and because it was so damn hard to learn, I didn’t feel an incentive to try anything else. Once you’re in the club, you’re in the club.

This is where my mistake was made. I grew as a developer and as a Vim user. This type of progress can be a trap for some of us. The momentum carries you forward, then you look back decades later and realize you missed some of the spice of life (variety).

My thoughts on Vim plugins

All of my original plugins were written in Vimscript, along with my .Vimrc. I would say it was moderately difficult to learn, but powerful enough to get things done. I think my old dotfiles repo still contains my last iteration. It wasn’t anything to brag about but it was mine. I expect every Vim user can relate. It really wasn’t until recently that I found people who were essentially writing entire programs in their config. Anyone else feel like this age of hyper customized, extremely curated config files is relatively new?

The transition to Lua for NeoVim was something I took on only recently, around a year ago. Luckily Lua is an easy to use language and I have used it plenty in my career that this wasn’t a high friction transition. What I will say is it only exacerbated that feeling of writing a program to configure your editor. I was feeling kind of annoyed about the whole thing and felt a sense of solidarity for those who escaped to VSCode.

The irony of this of course, was that I was about to step into a very similar world with elisp.

Emacs progression

How did I get here?

I have a few friends and colleagues who are massive Clojure fans. Clojure is something I had on my TODO list to learn for a couple of years now. As my new PC arrived I was eager to pick up a new project and it felt like it was time. So I did what everyone does these days. I went to YouTube and started watching Clojure talks and a few tutorials to get me off the ground.

I’m pretty sure what happened next I can thank the YouTube algorithm for. One of the Clojure talks was a screen share of programming using the REPL in Emacs. I will say, it piqued my interest because I honestly haven’t ever installed or opened Emacs before. I was immediately curious about some of the workflows that were demonstrated. I spent the next day getting my NeoVim setup with the appropriate plugins to do the same, and yes, of course you can do all the same stuff in Vim.

At that point I was pretty set on opening up nvim the next few days and plugging away at a project I started, which was to rewrite a MUD client using Clojure. This is a particularly bad introduction to Clojure by the way, I would advise against that kind of thing and instead focus on something that highlights the true benefits of the language.

Why did I dive in?

I consume a lot of YouTube, shamelessly 👀. I much rather watch educational content, especially programming / science related content, over binging Netflix all night. Not that I don’t do that occasionally of course, I am only human!

The last video I had watched, namely the Emacs / Clojure tutorial had vastly altered my feed. Suddenly instead of seeing the green Vim logo all over the grid, with the SWE influencer of the month making ridiculous faces next to it. I was presented with Vim vs Emacs talks, and this purple E logo. I gave into the temptation to see what it was all about and pressed play.

What followed were 3 critical revelations presented by the endless stream of YouTube videos.

1. evil-mode

Did you know you can emulate Vim from within Emacs? I had heard of this in the past and thought the nod to the never ending religious war it was sort of cute. Vim = “Evil” (Extensible VI Layer), great right? 😆

This means you can keep your Vim habits, you don’t need to learn all of that “control claw” stuff you were warned about in Emacs. More importantly you can keep modal editing and all the power of Vim movements. It even provides the : operator as a means to run commands that would otherwise be available via Meta-x (Alt-x), commonly referred to as M-x.

Pretty immediately that just destroyed the major barrier to entry for me.

2. org-mode

The next video that I stumbled on was another example of the great YouTube algorithm perfectly targeting me. I am a big note taker, I’ve used a variety of methods over the years. Some of them were in Vim, but I also used GUI apps like Todo, Evernote, Notes.app, Notion, Obsidian, and probably a handful of others that I can’t recall.

As a brief aside I would like to say, I think Obsidian and Notion are great tools. Of late though, I’ve been trying to move away from cloud storage and telemetry hungry applications. I really don’t need my personal or work notes combed by advertisers, or worse.

We probably all know that Emacs is notoriously more akin to an operating system than a text editor. Org-mode itself is no exception. It is a super powered note taking mode that includes provisions for clocking in and out of tasks, scheduling TODOs in whatever method you like to use, creating organized lists and even tables, honestly I can’t even begin to cover all that is the glory of this beautiful tool.

I will leave you with a link to get started, this isn’t the sales pitchy video I first came across, but it is excellent tutorial content once you decide to try it yourself. Subject your YouTube feed to the same algorithmic bomb I did by checking out Rainer König’s Org-mode playlist. This content is so informative but also such a joy because it sounds like Arnold Schwarzenegger is teaching you Emacs.

3. LISP

I mentioned I was interested in learning Clojure right? Well, I didn’t really get that far because first I needed to setup my new exciting editor/IDE and wouldn’t you know, it too has a language for configuration known as elisp, or Emacs Lisp. Having never learned any form of a Lisp language, this was an amusing challenge for me, to learn Emacs itself along with it’s built in programming language in order to get things functioning how I wanted them.

The first thing I will say is, it’s not as scary as it looks. The old ((((parenthesis vortex)))) jokes are true sure, of any lisp. The language itself is not complicated and once you spend a day or two with it you’ll be just fine. Besides we have ChatGPT and Co-pilot to bail us out these days 🤖.

Really though, writing my config from scratch was very fun for me, it brought me back 20 years to learning Vimscript and since I was recently primed for this sort of reality after rewriting everything in Lua, what was one more config file? Due to the nature of how elisp and Emacs work, you can just test your changes without even restarting by pressing Ctrl-x-e from the end of your expression, or C-x-e in Emacs documentation lingo.

What is keeping me here?

  1. My first two points above are huge selling points for me.

  2. I always rebind Ctrl to Caps Lock, in fact my keyboard has the key cap ligatures swapped, that is how committed I am to the idea. So some of the various C-c and C-x command chords don’t bother me at all.

  3. I actually like the mini-buffer interface that pops up when I don’t know exactly what I need, but I can guess at what it might be called. In Vim, you’d have to start by searching for help. In Emacs I get a helpful list of what I can type, that is filterable! I’m sure you could install a plugin in Vim to do this. I’m not talking about WhichKey by the way, which I have in both Vim and Emacs which looks like this. which-key

I’m talking about this… which-key

  1. A whole bunch of things that would otherwise be additional must have plugins for Vim are basically built in, so less to download and configure, and not to mention depend on for updates.

Some honorable mentions

  1. 🦣 Emacs Mastodon community is welcoming and helpful.
  2. 📚 The joy of learning and discovery and breaking out of my 1-dimensional point of view regarding Vim.
  3. 📱 There are mobile apps for org-mode agendas so I can update my TODOs on the go.
  4. 🤯 Literate configuration of Emacs through tangling! You can find mine here Emacs config

Answering some obvious questions

Why didn’t you just use an Emacs distribution like Doom Emacs or Spacemacs?

For the same reason I didn’t enjoy using NvimChad. Someone else’s configuration is maybe good for you, but for me I don’t want to have to delve through someone’s code and learn it, just to accomplish what I could have done on my own.

I also believe they are overkill for me. I’m a hobbyist programmer at this point, my job doesn’t require me to have an ultra charged, ready for anything IDE. I can more surgically setup my environment for a weekend project and not concern myself with the fact that it isn’t implicitly ready to tackle the next thing.

Finally, I learn by doing. I learned Vim “the hard way” like this, and it made me very competent in it. I get so much value from this type of process and I wouldn’t trade it away just to make my Emacs look cool out of the box. 😎

Are you never going to use Vim again?

Of course I am, and I do all the time. Whenever I’m in a shell and I need to make a tweak, my fingers instantly type vim. That habit will never change. For long form writing like this blog, programming projects, even shell scripts, I’ll gladly jump into Emacs.

What’s the point of this article?

I suppose I’m hoping you will use this as a form of inspiration to try something different and break out of any channel, rut, or mold you have been stuck in. Whether it’s Emacs or otherwise, I’d love to hear about it on Mastodon.

Also, not everything needs to have a point. Sometimes you should write, or read, just for the sake of it!

I hope you enjoyed this little story and update on my hobby.