A few months ago, I switched from emacs to vi.
This is a really big deal, so please take a moment to process this fact.
If you don’t have a strong opinion on this matter, let me explain what the big deal is in the editor war.
People have lots of tiffs in technology choices. The most common choice is Windows versus Macs, with the latter having a fanatical user base willing to argue strongly in the superiority of their operating system. In the coding community, we argue about the best text editor to use. Programmers spend more time in their text editor than anywhere else because that’s where code is written. Although we could use simple editors like Notepad or TextEdit, we prefer to have more powerful tools. Just as Microsoft Word is a better word processor because of spellcheck and formatting tools, editors like emacs and vi are better text editors because of autocomplete and syntax highlighting.
There are, of course, many different choices of editors, with much bigger differences you would see between Word, Google Docs, Pages, or other word processors. Some, such as Eclipse and Visual Studio, have a full graphical user interface (GUI) with multiple windows, menus, and buttons visible to use. These editors visually are similar to modern word processors. Although these environments are powerful, many developers such as myself, prefer to work from command line editors, which still have the blocky, text-only appearance of things like MS-DOS. They definitely have a steeper learning curve, but the 80s-like interface still has its advantages. The primary advantage is more extensive reliance and support on keyboard shortcuts (think “Control-C” instead of clicking the “Edit” menu and “Copy” option for copying). Programmers can keep their hands on the keyboard the entire time instead of switching over to the mouse.
Within this world of command line editors, there are 2 primary flavors from which the rest are derived: emacs and vi. Both offer a lot of power from the keyboard, but they were built very differently, both conceptually and technically. The biggest difference for regular usage is that vi is modal, but emacs is not.
vi is modal because keys will perform different actions depending on which mode the editor is currently in. The most common mode is “insert-mode”, where typing letters will insert characters, like any regular text editor. If you exit this mode (by hitting “escape”), you return to “command-mode”, where many other actions are available. For example, “Y – Y” will copy the current line, and “P” will paste it.
emacs is not modal because there aren’t multiple modes. To add additional actions on top of letters, the user holds down modifier keys, just like in word processors. For example, once you have selected some code, “Alt – W” will copy that code to the clipboard.
The differences go far beyond that, but in short, programmers have irrationality strong opinions about which editor is better, which is usually based on first exposure, not reason. For example, Stanford mostly generates emacs users since emacs is introduced in the 3rd programming class, whereas vi is never formally taught. That’s where I started, and only the next 5 years, I learned more shortcuts and became a faster coder.
I eventually hit a roadblock with emacs, though, and it was physical, not mental. I code all day for my job, and I spend a lot of time on my computers in the evenings. Between all of that, my fingers really started to hurt. As I mentioned, emacs uses modifier keys for various actions, which is a lot of holding down “control” and “alt”. I tried to reduce the awkward hand positions as much as possible: I swapped the “control” and “caps lock” keys on my left hand so I had easier access to “control”. I learned to use both “alt” keys for different combinations to split the workload. Despite these adjustments, however, I still needed to both stretch my pinkies and tuck my thumbs to hit keys, and that wasn’t getting better.
So I overcame the ridiculousness of a modal editor (where keys do different things without telling you when such is the case) and tried out vi. It’s been a few months now, and it’s turned out well. I don’t think I’ll ever be as fast with vi as I was with emacs, but more importantly, my hands don’t hurt. I still use emacs occasionally (for example, it integrates with the python debugger really well), but I’m fully capable of switching contexts and my mental set of shortcuts to use both.
I’m glad I can use both. It’s like being ambidextrous, or being a pitcher and catcher. But more importantly, I feel really awesome. Programmers who use command line editors generally think they’re superior to programmers who use editors with GUIs, and being able to use both of the major command line editors is even a step above that. So switching wasn’t just to help out my fingers: it’s been good for my ego, too