Editor Throwdown

Posted on Tue 30 May 2017 in Programming

The winner is both!!!

Yeah I know, the link is click bait in a way looking for yet another spin on the ongoing flame war between these two editors. But let me put it this way. If either of these are your bread and butter then I promise you that you are doing something right in my book. Both editors are remarkably powerful for the type of text editing that programmers need to create code. Meanwhile neither of them adds too much artificial tools that hide you away from what is going on behind the scenes. Also, both have a massive ecosystem of plugins.

So why vim?

Really I should say why vi as well. The simple fact is that if you work in any *nix environment you can pretty much count on at least vi being there if not vim. Also vim really is the better choice IMHO for working over ssh on a file. Yes Emacs has tramp for connecting to remote files but I find when working on remote edits screen + vim is a far better combination.

Even if your preferred environment is Emacs (like me) you really must know a good foundation of vim basics. Of these I would include navigation and mode switch commands, writing/opening/closing commands, search and replace commands, copy (I mean yank) and paste commands. Also I will add in knowing how to work on multiple files at once through the :ls and :b# commands. Splits, and tabs are nice, but not in regular vi. Yes I use them in vim but again I use screen so it is not always important. One other one I will add is being able to execute commands with ! and even better bring the output into the editor with r !.

Now vim also has plenty of plugins but my typical method is to avoid all extra plugins and just go for a sane .vimrc. Main reason is I prefer Emacs and vim is a fall back. But also as I mentioned the reason I stress knowing vim is its everywhere existence and because of that I don't want to depend on a plugin I might not be able to install on a given environment where I need to fall back on vim. If vim is your end all be all go for it. You probably know vim well enough to not need them if push comes to shove. For us visitors from Emacs land though I would hate to get comfy in them. Yes I know I use an insane amount in Emacs.

So why Emacs?

For me the area Emacs shines is summed up with two use cases:

  1. Programming, I find Emacs is pretty much the most flexible IDE there ever was.
  2. Note taking, org mode is amazing and I have found nothing close to it in vim land, although I expect there will be comments with tons of alternate examples.

Emacs in my view is a much better environment for working across a large set of files at once. You know what most programmers have to do. To me the process of switching between windows, creating and sizing windows, and moving files into view between the windows is much better in Emacs. I am going to remind everyone again this is my personal opinion.

See the real beauty of Emacs is I just open it and it is open all day. Heck in some use cases Emacs is my WM (keep in mind my preferred WM is usually Openbox or Qtile). Emacs becomes my all day programming and writing home. On any computer I work on I have a work space dedicated to Emacs open on the full screen whatever I need to do I do there.

So why both?

I will speak for myself. I am yet to have a work day that didn't involve both being opened at one point if not several in a day. Knowing both allows me to deal with whatever has come up at that point without missing a beat. Vim is my editor when working on a remote file, or a quick one off need while in that directory. Emacs is my larger project editor.

So yeah there is no winner. Except you for learning one or both of these editors. Let's end the flaming between them and instead do more productive things like flame all GUI tools. OK I kid. However even if you are strongly in one camp or another I recommend giving the other side a try. Whichever that other side is. I think either way that leap is you might just learn something useful to add to your programming tool set. You might take that into being a new plugin elsewhere to improve either of these two tools. In the end as programmers what is more important is that our chosen tool can help us get the job done in the best and most efficient way.

Oh and I typed this in Emacs if you are wondering. But I spent most of the day in screen + vim working on some remote tasks.