June 4, 2017

1165 words 6 mins read

Reminiscences of my "Vim to Emacs" experience

I’ve been using Emacs as my main editor for about two years now, and so far it’s been the best programming tool I’ve ever used, however is not for everyone, I think Vim users and Emacs users are somewhat compatible in their tastes while some others wouldn’t like either of those and prefer simple solutions like Sublime Text or Atom.

However before using Emacs I was a purist Vim user that would stand firmly in the Vim troop for the Editor war. Little do I knew that years later I will be accepting that Emacs is indeed a superior tool.

In fact let me elaborate on that, it isn’t exactly true that Emacs is better than Vim and the same can be said of the opposite. I think that the best editor out there is the combination of both as each one of this editors have the power to embed the other inside them. Let me first relate my experience with Vim and why I switched to Emacs.

When I started using Vim I recall thinking that it was a weird text editor but all over geek forums I could read that if I was willing to take the effort and learn the Vim way in the end will be worth it. And after some years of using vim… I totally agree, the advantages of using a modal editor for our software development profession are huge, we spend most of the time maintaining software rather than creating new code from scratch, the refactor capabilities of Vim are undeniably better than those found in any other text editor.

However it wasn’t all fun and games in Vim land. When you learn the Vim way you can’t accept any other way. After using Vim for about four years every time I had to use any other editor to help colleges I seemed to be a completely typing noob. Once you learn the Vim way, typing in a common text editor is like trying to code on a tablet or phone keyboard, it’s a frustrating experience. So keep that in mind if you’re going to follow this path.

Thanks to the Vim community we have Vim like plugins for any other editors, sublime comes packaged with Vintage, Jetbrains IDEs (pycharm, phpstorm, android studio, etc) have IdeaVim and Emacs has Evil the best Vim emulator out there. But why I was trying to use other editors?

At the time Vim support for asynchronous tasks was lacking, if I wanted to run tests from within vim the UI will be blocked, later on I found vim-proc so tasks like this could be executed outside the vim process, but this always felt hacky to me, you know, when something works but doesn’t feel right. At the time I also used multiple monitors and I wanted to have Vim across multiple displays to see multiple files and this couldn’t be done without opening another Vim instance which would have it’s own context. Also as a heavy CLI user myself I wanted to interact easily with the terminal within Vim, I tried to use tmux but it wasn’t for me, in the end I choose Shuogo’s vim-shell it wasn’t quite as good as a real zshell but it worked.

At this point you can see that I’m a very strict user with my tools, they need to be in top shape for the job. This kind of small things made me to seek a better alternative and was when I decided to give it a shot to Emacs.

The first time I tried Emacs I hated it. I couldn’t work with it, the bindings that they use didn’t make any sense at all, it wasn’t like Vim where you can “speak” to your editor and code at the speed of thought. Of course I just thought I’ll need some training to get used to the Emacs way but as I said earlier, once you follow the Vim way there’s no other way. This annoyance made me to try Spacemacs instead, a Vim flavored Emacs distribution that aims to be the best of both worlds, and let me say it is a good approach but in the end was “not quite my tempo”.

The first entry barrier I had is that for every command a window will pop up with options (customizable), at the time I didn’t like SPC as the leader key (also customizable and the weird thing is that I’m using this as a leader now 😅), another thing was that it felt like an IDE with a bunch of things installed that maybe I wouldn’t need at all.

At this time was when Neovim took off, a Vim fork driven by a community that was aiming to resolve the issues I had with Vim. I steeped back and installed it right away!

After some frustrations with the back then unstable neovim I tried Emacs once again, but now I was to build my own configuration from scratch with Evil on board. Every annoyance I had I fixed it right away with some elisp code I found on forums. Once I took An introduction to Emacs Lisp I started to understand those copied and pasted snippets in my config file and started to improve bits of them.

At this point I was sure that elisp was a better config language for Emacs than Vimscript is for Vim, and I took the time to learn Vimscript (practiced with the unknown vim-laravel plugin) so I think I have some elements to say that.

In the end I just want to say that I never stopped using Vim, well … of course I did, I’m just writing this within Emacs but with modal editing, i.e. The vim way. And I have my vim command aliased to nvim which is far more stable now than it was two years ago and use it when I want to edit some file quickly, but when I have to do serious coding tasks, then Emacs is my way to go, of course Neovim can also do it but in this regard Emacs is just superior for me.

Just remember, if you are a vimmer wanting to learn Emacs so maybe you’re more proficient, please don’t waste time learning the Emacs way, it can’t compare to the Vim way of editing text. Vim is the best text editor out there, period. Emacs is just a whole suit for developers which lacks a decent text editor. At the same time you shouldn’t lose focus, we write code here, so don’t let this editor clash to stop you from building that next great idea, perfection doesn’t exist, just pick a tool and start working on it.

The next time I’ll share some configuration tips for vimmers in Emacs lands, but in the mean time I suggest watching the talk How I learned to stop worrying and love emacs which was of a lot of help for me when I made the switch.