2023-11-09
Brief early impressions of Emacs' evil Vim emulation
Emacs has a third party package called evil (also, also) that is "an extensible vi layer for emacs". Faced with such a pitch I couldn't resist trying it out just to see it do Vim tricks, and then I experimented to see if it would be useful in one narrow specific situation for me, with inconclusive but educational results. The short summary is that evil is an impressively comprehensive vim emulation (it passes my vim noticeable features checks), but I apparently have deeply embedded Emacs reflexes that get in the way of using it.
Purely as a vim emulation, evil seems quite comprehensive in my limited testing, including features like reflowing paragraphs by piping them through !}fmt. It doesn't get quite everything, for example it doesn't have vim's arithmetic operations, but I'm relatively convinced I could edit in evil without really noticing that it wasn't vim. As someone who knows a bit about how Emacs works, this is somewhere between impressive and scary; there's a lot of hard work involved in making it work so well and for so much. In addition, some of the details are very nice; for example, under X evil will change how the cursor looks depending on the (vim) mode you're in.
I have a long history with Emacs and I'm quite comfortable in it, so I didn't have any interest in switching from normal Emacs bindings to emulated vim ones (and I would expect the combination to be kind of a mess for reasons beyond the scope of this entry). However, since more or less switching from exmh to MH-E in GNU Emacs for my GUI mail reading, I've wound up in a situation where I write most of my replies to email in GNU Emacs but compose most new messages using command line NMH and vim. This is a little bit of whiplash as I go back and forth, so I thought it might be nice to use evil to give the MH-E 'reply to mail' experience the same vim keybindings that I use when writing new email in vim.
What trying this taught me is that my Emacs reflexes are sharp and deeply sunk into me. It didn't matter to my reflexes that I was writing NMH email and up until now I've spent a lot of time doing that in vim and none in Emacs (well, not for a very long time). My reflexes 'knew' that this was Emacs and thus (for example) that I typed ESC < to get to the top of the file, not 1g. If I thought about it I could write email messages somewhat reflexively using vim keybindings and vim reflexes for things like reflowing paragraphs, but every so often I would slam into a wall when my Emacs reflexes triggered.
(It probably didn't help that actually sending the email required dropping back to Emacs reflexes for keybindings like C-c C-c, and also that flyspell would periodically pop up to mark words with squiggles that are never there in my vim sessions.)
I'm keeping evil installed, partly because I admire its sheer achievement and partly because someday I may find a situation where the vim keybindings are clearly more efficient for what I'm doing. It doesn't really hurt to have options, even if I don't expect to use it very often.
PS: If you didn't know Emacs but wanted to use it for an application like Magit, I imagine that using evil could be quite appealing. You'd get all of Magit's power for things like selective commits but you'd get to write commit messages and so on using your familiar vim reflexes, with only a few odd keybindings to invoke Magit or commit your commit messages.