Estimated reading time: 4 minutes

Evil Emacs steals my heart

Many of my co-workers use emacs, it is probably the most popular editor on our team and I understand why.

Editor icons

I was an emacs user — via MicroEMACS and later GNU Emacs — for many years but at some point I switched to vim. I can’t even remember the exact catalyst for change, but I am pretty fickle so it may not have even been all that important.

Lately, I’ve found myself diving back in to emacs. In large part this is because of evil; I can be in emacs, but live vim.

Evil isn’t always evil

So, evil-mode is awesome.

The kindest thing I can think to say about it is this: You’ll be angry when it doesn’t work

This isn’t because it often breaks, quite the contrary. It is simply because it feels largely seamless. I’ll give an example that mimics a recent session to make my point. For example, you’re hovering over a number you need to change:

int magic_const = 974;

In vim, you can execute ciw<C-r>=@"/2<CR> to cleave the number. The command itself is saying:

ciw

Change the word my cursor is on(change inner word)

<C-r>=

Insert the result of an expression(see :h i_CTRL-R_= for awesomeness)

@"

Use the text from last filled register, ie the text we just marked to be changed

/2

Half it

<CR>

Wow.

int magic_const = 487;

Whilst performing the same task thing in evil-mode I receive an error. Emacs — quite rightly — expects you to write an elisp expression. There is nothing wrong with this, but it is a sign of how good evil-mode is. It is literally so good I forget I’m not using vim.

Oftentimes a tool’s vim emulation can be summed up as needing to press a key that kind of matches what something in vim might be, assuming you didn’t really know what the key might be or when you’d use it. Be that sublimetext’s vintage package that isn’t much more than normal and insert mode, or elogv’s bindings that mean you have to issue dd to kill an entry. Frankly, many of the emulation layers often feel like you’re just doubling the number of keys you have to press without any benefits1.

Quirking the quirky

Emacs screenshot

I’ll freely admit I’ve vimified my emacs. I use evil, my mode line uses powerline to match vim-airline. I have zap-up-to-char mapped so that I can mimic dt when evil-mode is disabled.

Screenshots for emacs and vim really aren’t all that useful, because it is the workflow that makes these tools powerful… but, above is my current emacs and below is my current vim.

vim screenshot

The big thing you’ll notice is the fonts. In emacs I’m using scaled text for headings in reST files. I’m close to believing that headings, proportional fonts for comments and the occasional inline image are enough to switch to emacs.

Inline images in Emacs

In the third image you can see emacs is displaying the emacs screenshot in the buffer for this post. This example may be quite pointless2, but it can be nice to have graphviz output class hierarchies in to a buffer or database schema popups(like below).

Schema diagram

Walking the branches

I’ve decided to really dig in this time, not just switch on a whim. I’m using emacs and only emacs for a month, followed by vim and only vim for a month. I’m busily writing a document of bugbears about both3, and then figuring out which I want to fully invest in to. I need to stop flip-flopping.

I will say that there isn’t much in it. With a converging setup there are fewer and fewer differences to care about. Things like the expression register usage above, or built-in versus external HTML preview for documents like this.

I’m actually wondering whether a neovim client in a emacs frame would be the golden option. If you know of such a thing or a better option, drop me a mail!

Footnotes

1

elogv for Gentoo is probably the worst example of this, as d almost works like vim but nothing else does.

2

Okay, completely pointless.

3

org-mode and vim-orgmode allows me to keep this across editors. There is very little point publishing it, as it can be summed up as “James pressed <C-x>$something and was surprised.”


Authenticate this page by pasting this signature into Keybase.

Have a suggestion or see a typo? Edit this page