Kindness City Blog
25 Aug 2021

Vi vs Vim vs Emacs

Vi vs Vim vs Emacs

There was some chatter at work recently about vim vs emacs. Here are some of my thoughts about which editor I prefer when, and why.

If I find myself on an unfamiliar machine, I tend to reach for vi (or vim if available). Pretty much every non-windows machine has vi.

If I'm remote pairing with someone who's familiar with the tools, I love the vim/tmux combo. I've found no better terminal-based dev experience for remote pairing, and I've never found a gui-based experience that can match it for robustness or speed. In this environment, I'm a big fan of Luan's vim and tmux configs. They also work well with tmate if you like that service. I used this setup for years as a golang IDE, complete with shortcuts for smart code-navigation, running tests, performing refactors, and so on.

If I'm scripting an edit for maximum portability, I use ed. It's at least as ubiquitous as vi (it is the standard text editor, after all) and it's way easier to script. It's also fun, and worth learning for what it teaches you about (the history of) unix, and the other editors in this post.

But for solo work on my own machine, emacs is awesome. I love that I can use it to unify the UX of almost all the different systems I need to interact with. This allows me to seemlessly combine features on those systems to build unified workflows that suit me personally. For example, I read my email using mu4e:

  • If someone emails me asking for me to do something by the end of September, I can hit C-c c to capture a task (with that deadline) based on that email. That task goes into my org-mode task tracker, with a hyperlink to the email.
    • If I spot a bug while editing some code, I can capture a task to fix that bug in exactly the same way by hitting C-c c, and it will contain a hyperlink to the code where I found the bug.
  • I can schedule my tasks, note deadlines, etc.
  • When I start work tomorrow morning, I can hit C-c a to see all the tasks that are relevant to my day today.
  • If one of those tasks involves replying to some email, I can follow the hyperlink to the exact email I need to reply to (by hitting C-c C-o) and hit R to reply.
    • If one of those tasks involves fixing the bug I found, I can follow the hyperlink to the exact line of code I spotted in exactly the same way by by hitting C-c C-o

Hopefully this gives you an idea of why emacs people sometimes like to do everything in emacs. Once a workflow is in emacs, it can be unified, combined with other workflows, and scripted. You can get close to the experience with old school UNIX CLI utilities – but then you generally have to forego readline interfaces, so that you can pipe the utils together. In emacs, the user-friendly UI is also scriptable.

I've never seen anything close to this level of flexible integratability in any software other than emacs and the UNIX CLI.

Things I currently do in emacs include:

In the past I've also done some web browsing in emacs, but these days I make do with having a bookmark-capture widget built into my firefox and chrome installs. This lets me capture pages in org if I want to save them for later. That widget is just a bookmark in my browser bookmarks toolbar, which links to the following "address":

javascript:location.href='org-protocol://capture?template=b'+           '&url='+encodeURIComponent(window.location.href)+            '&title='+encodeURIComponent(document.title)+            '&body='+encodeURIComponent(window.getSelection());

If you're interested, you can find my emacs configs here.

Tags: unix linux vi vim emacs ed org-mode UX

There's no comments mechanism in this blog (yet?), but I welcome emails and tweets. If you choose to email me, you'll have to remove the .com from the end of my email address by hand.

You can also follow this blog with RSS.

Other posts