I’d been a vim user for about a year when I started learning lisp. In the free lisp IDE world, there’s pretty much only one player, and that’s emacs (with SLIME). Writing lisp in vim can certainly be done, but it doesn’t compare to the integration available in emacs. Lisping in vim is destined to be a bit of a hack job, so I resigned myself to learning emacs.
I could not have anticipated how hard this would be.
The reason this was so difficult was because of how powerful and customizable both vim and emacs are. Switching from notepad to wordpad presents no difficulty at all: there are only a handful of shortcuts available, and it’s practically impossible to customize these programs.
The file that holds vim’s customizations is called a vimrc. This is analogous to emacs’ .emacs file. My vimrc is over 300 lines long. Have you ever been in a luxury car that stores profiles for each driver? When you get in the car, you press the appropriate button and the seat, steering wheel, and mirrors adjust to your favorite settings. Vimrc and .emacs files provide the same thing, only you can go ahead and move the steering wheel to the passenger side, reverse the gas and brake pedals and put ten new gauges on your dash (and change the color scheme while you’re at it).
Going from vim to emacs wasn’t just going from editor to editor. I was leaving behind a tool that I’d perfectly tailored to make me as efficient as possible. In vim, I was a text surgeon. Certain commands and techniques were so hardwired in my brain that I couldn’t tell you what keys I’d pressed to use them–they were at the level of muscle memory. I had clawed my way up the learning curve and I was fast. I was deadly.
I was leet.
Using emacs, I was suddenly booted back down that learning curve. Now I had to refer to a cheat sheet to remember how to SAVE. Every five minutes I was googling “emacs cut paste,” or “emacs new buffer.” Ugh. I was a noob, and I missed vim.
I’d like to tell you I was mature about this. That I realized I was just facing a steep learning curve and I’d eventually reach the same level of competency I enjoyed in my old editor. Instead, I got my vim friends together and bitched about emacs. I whined about the key chords, and mocked the features that were shortsightedly omitted (read: I couldn’t find them yet). I even considered writing a post here blasting what I saw as emacs’ shortfalls.
The problem, of course, wasn’t emacs, but me. When you are able to program as efficiently as vim will let you, trying emacs for the first time will leave you feeling slow and disoriented. It’s extremely unpleasant, and it’s human nature to blame this discomfort on the editor, rather than your own ignorance.
I’ll be honest: the experience was so demoralizing I gave up, twice. The need to learn emacs very nearly prevented me from learning lisp. And if lisp hadn’t been such an excellent and promising language, I probably would have given up permanently.
What finally turned me around was forcing myself to learn. I got a hard copy of the emacs manual, and I started hanging out in the #emacs on freenode. I read Effective Emacs and incorporated several of Yegge’s ideas. Perhaps most importantly, I started growing my .emacs file.
Today, I’m still not quite as comfortable in emacs as vim, but it’s close. And when it comes to the task I’m doing most often (slinging around s-expressions), I’m getting pretty quick. The experience has been a bear, but the insights it’s given me have been worth it.
There is a well-known holy war between vim and emacs users. Both sides are, of course, convinced their editor is best. I now know why this debate is so fierce: the faster you are with your editor, the more you will hate any other editor you try. In the beginning, I couldn’t believe how much I hated emacs. If I’d given up and quit, I think I’d be right there in those flame wars, bashing the abomination that is emacs and extolling the virtues of vim. I think this is where the most passionate critics in this war come from–they’ve tried the other guy for a day or two, and it was awful, basically because it was so damn unfamiliar.
Changing my editor has been just as hard as learning lisp has been, if not harder. Some nights I’ll spend twenty minutes writing lisp, and two hours customizing emacs. But this is natural. Lisp is a powerful tool because it lets you grow the language up to your program. Effective programming requires growing your editor up to your tasks. Every day I make emacs a bit better for the type of work I am doing.
Before I wrap up, I’d like to point out that if the title of this post sounds suspect to you, consider it a huge red flag. If the thought of switching editors doesn’t fill you with quite a bit of dread, what you’re using now is almost certainly underpowered, and you definitely haven’t customized it enough. If this is you, take a look at one of the editors I’ve been discussing here, and take the time to learn it–I promise it’s worth the trouble. Just, uh…choose carefully.
27 Comments
Personally I think that editors which require a long learning curve are the ultimate problem.
I started with vim and tried out emacs. I dont have a strong dislike for emacs but i never really used it a lot.
However, I also never really explored EVERYTHING in vim, simply because I grew tired of it in the long run. I dont want to adapt to an editor and a quirky ancient syntax.
I prefer human readable syntax, smart and logical conventions. And i also miss the GUI power of certain IDEs…
I hope that one day we can leave behind BOTH vim and emacs and have something like Eclipse, but a lot lighter, and with a much more “productive geek” approach who enjoys human-readable stuff.
I still like vim keybindings though.
Have you tried viper, the emacs vim mode?
Pedro: I have, a bit. It felt sort of like I was going against the grain of how emacs was supposed to be used–almost like I was using it like a crutch. I wanted to learn “pure” emacs so I could really get a feel for how it was supposed to be.
Your links on “lisp in vim can’t be done” don’t mention VILisp. While not as complete as Slime, it does allow interaction with the REPL from vim and various source management tools.
I know this topic in reverse, having switched from Xemacs to Vim many moons ago. It’s not easy, but it was worth it to me.
Anyone who claims that one is absolutely better than the other is a fool. You can only know which is a better fit for yourself.
I had a very similar experience when I decided to try using Eclipse for Java coding. I’ve been using (and loving) emacs for 10 years. I also use vim on a daily basis (what can I say, I’m a freak). But even with JDEE, emacs support for Java is pretty flaky, and some of the tools in Eclipse looked quite useful.
For at least six months, I completely despised Eclipse — I ranted about it on a daily basis. After about a year, I’ve come to a happy truce with it. Eclipse will never be as good an editor as emacs. The UI metaphors it uses just aren’t as powerful. But it is a very nice tool for Java coding. I spend my days at work flipping back and forth from one to the other, and instead of ranting, I just appreciate what each has to offer. The only thing I could really ask for at this point are some fixes to Eclipse to make it cooperate with external editors better — I’d like it to just reload changed files without prompting me, and to NOT remember which editor I last used on a file.
I’d like to get better at vim — I do only very basic editing with it, and I honestly don’t understand why people think so much of it. But so far I haven’t hit a “killer app” to make me invest more time in it.
>>On 02.22.08 she wrote these pithy words:
>>Personally I think that editors which require a >>long learning curve are the ultimate problem.
If you use an editor professionally, every day, I think it’s perfectly acceptable for it to have a learning curve.
Don’t master craftsmen have to take a long time to find and customise the tools they use?
If you basically want notepad with a few developer friendly options in the menu, then visual studio and eclipse are already there.
I did the switch from jEdit to Emacs about 5-8 years ago. It was VERY painful. Not only did I have a custom jEdit but I was writing jEdit plugins as well.
Emacs really sucked me in though… I used it on Linux and made the switch to OS X… my OS X environment still isn’t setup perfectly though.
I miss Linux+Emacs :-/
“I think this is where the most passionate critics in this war come from–they’ve tried the other guy for a day or two, and it was awful, basically because it was so damn unfamiliar.”
This is why UI designers are paid the big bucks, so that you can sit down at an application and immediately grasp its power, utility, and flexibility, but not have to look at the manual to figure out how to do stuff.
Macros are for bitches.
http://xkcd.com/378/
There is definitely an editor holy war between Vim and Emacs, and I consider myself a humble Vim soldier. But, despite all the jabs I’ve taken at Emacs (which is, to be fair, a great operating system :), I am forced to recognize that when all is said and done, the Emacs-ers and myself are on the same team. The _real_ war of philosophies is us against the “long learning curves are bad; notepad or my IDE is good enough” school of thought.
Ideally the editors should have every command reachable from a menu and a customizable key binding next to the menu item, like the windows 3.1 standard. Then its easy to learn. I don’t care if its 2000 commands, just nest the menus. Should’t this be possible to integrate in Emacs? Make Emacs lisp have commands for creating menu items, and then just loop over the commands. Btw, try using your OS without a mouse for a day, at least in windows its totally possible (if your not a photoshopper..)
Agreed!!! I made the switch from vim to emacs a while back. I wasn’t a power user in vim so switching to emacs, though hard, wasn’t completely demoralizing.
However, twice now I’ve tried to switch from the QWERTY keyboard to the Dvorak keyboard. Now that’s demoralizing!
“The need to learn emacs very nearly prevented me from learning lisp.”
a.k.a., “The lack of a decent Lisp mode for vi very nearly prevented me from learning Lisp.” :-)
P.S., you misspelled “l33t”.
@Joe Webb: Funny you mention it — I’ve used Vim for around 7 years and Dvorak for 5. Together with Python, they form a groove I won’t get out of easily.
I too tried Emacs and Lisp. While I appreciate them, and got to the point where I can get by, I dropped the endeavor after a few months.
I can’t say I feel strongly about the “long learning curve” issue. I recently took a good look at gedit. If so much of what I use an editor for wasn’t terminal based (usually over ssh), I could see it suiting my needs. I was also impressed by the variety of commands I discovered in nano after playing with it for a little while. If only it had an undo…
The real problem I would have with any other editor is that I think in Vim. Even in text boxes like the one I’m typing this into now (though I could be using Vim — thank goodness for ViewSourceWith) I’m constantly hitting the escape key and “:w” and “{wdw” and who knows what other crazy key combination. In that respect, it’s as ingrained in me as the language I grew up speaking. Vim, I just can’t quit you.
“Certain commands and techniques were so hardwired in my brain that I couldn’t tell you what keys I’d pressed to use them–they were at the level of muscle memory.”
I was explaining this to someone a few weeks ago. Interesting article. Perhaps the most sane discussion I’ve seen related to the topic of switching from vi(m) to emacs (or in the other direction). I had a similar path learning vi early in my career along with some heavily customizable DOS editors way back. I’m cursed with a personality that drives me to learn the details of any tool I use. I’m an emacs user now and have been for about the past 6 or 7 years. The efficiency gained once you get past that learning curve with either editor is beyond comprehension if you haven’t achieved it yourself. With emacs I can write code or prose closer to my speed of though than any other tool.
I’m an ex(1) troglodyte — and have been for decades. Muscle memory R me. (I know, I know, ed(1) is the standard editor — but I’m willing to trade a somewhat improved command set and UI for a little bit of standardosity.) As such, customization is the last thing I want.
I keep considering Sam, but it just doesn’t work as well remotely across multiple boxen unless all of them are Unixoid systems, and I can’t always arrange for that to be the case.
A Tale Of Five Editors is the best and fairest comparison of ed, Sam, vi, emacs and Acme/wily that I know, even if I had a good deal to do with parts of it under the table.
“Effective programming requires growing your editor up to your tasks.”
What sort of tasks require growing your editor, which can’t be done just using the basic functionality of a good editor? I mean, aside from oddball once-a-year difficult tasks that you might just instead write a short script to handle.
I agree totally. I am unfortunate enough to have felt the transition going both ways (I started out with Emacs, learned vim and switched to it, then learned Lisp and switched to Emacs. Both were very difficult)
One thing that I’ve found useful is:
;;; bind " : w q" to a few pithy words
(defvar wq "Hey! This ain't vim!")
Also, I didn’t learn Vim well enough to learn it’s machro commands, so I wasn’t abl;e to actually do this, but it may make sense to bind C-x to something harmless in vim. I can’t count how many times I’ve typed [C-x C-s] into a vim, and put the system into some kind of “^X” mode and locked the terminal with an XOFF. This is invariably followed by mad pounding of the keys in order to figure out what I’ve done, and then heroic use of the “Undo” feature to restore the buffer to a decent state.
@Erol
Surprisingly enough, your guess on the number of commands was closer than mine!
IELM> (length (apropos-internal "." #'commandp))
2459
Sigh, I’m still at the “given up on CL twice because of Emacs” place. I cringe at opening vim without my vimrc. Can’t build up the energy/time to try to beat emacs into usable shape.
Oops, hit enter on that last one by mistake.
Meant to add; could you post your .emacs? I feel like I’m coming from pretty much the same place so it might get me over a bit of the hump. (Is there a good .emacs repository somewhere?)
You think switching editors is as hard as switching languages? Wrong. It’s *harder*. Languages don’t go into your muscle memory (alright, maybe a bit, but not really). I don’t have to enumerate why, you’ve already made all the points why. Languages are comparatively easy to pick up; so many of them borrow ideas from each other.
Switching languages is hard if they have fundamentally different paradigms: eager vs. lazy, functional vs. impure, Prolog vs. everything else. Switching editors is like that.
This is why we should start having a higher-level shared library base for the OS, much like modern desktops provide. Unix should know what keystrokes you prefer to use for next buffer etc., regardless of what editor you’re using. Editors should plug into this, and use the shortcuts configured. Remote filesystems over ssh, tagging (web style or ctags style) should be available on both the command line and the GUI. Apps should be able to present a dialog to the user responsible for something, even if that user is coding at a console.
The problem isn’t editors. It’s the OS layer.
@Gabriel Sean Farrell: you might be interested to learn that KDE supports vim as a standardised editing component, including use in web forms etc. The actual vim plugin is a seperate project (yvis or something like that), but the support required is right in KDE core.
I understand your pain.
Back in the day, when VAXen were my standard platform, I had an EDT/TPU customization all singing and dancing, including things like binding functions written in one part of a split-screen to keys on the fly.
When they slid into history, I went back to beginner stage, and stick with menu picks and mouse-driven systems. To this day I still have to look up the emacs cut and paste commands, since they aren’t the otherwise ubiquitous ^C/^X/^V
i use ee.
yeah, make fun of me. it doesn’t matter. it’s notepad for my fbsd box. i code in it. i write my budget in it. i save a lot more files in it, too.
ee!
I am using Vim for Lisp (not Common Lisp, but newLISP) programming on everyday basis. I have write my own syntax highlighting mode for it, because the existing one was unsatisfactory. My .vimrc is 373 lines long just now. I do not although use it as IDE, I believe that very idea of IDEs (eclipce, visual studio, emacs, any) is bad. What’s wrong with me?
Once, because of some strange OS error, Vim stops to respond to keyboard. I have spent about five minutes to realize that I can select File -> Save and then Exit form menu by a mouse. Never done this before. ;-)
2 Trackbacks/Pingbacks
[...] read this post: Switching editors is just as hard as switching languages. Fortunately my experiences with Emacs have been somewhat different. I was not looking forward to [...]
[...] Emacs, Lisp, Vim – Switching editors is just as hard as switching languages [...]
Post a Comment