How a Vim user converts to Emacs

For many years I thought that the heretics of the Emacs clan [1] were clearly insane – the followers of Vim were obviously following the True Path. And then I was snared by the dark side.

My primary motivation for starting to use Emacs was so I could use the Slime[2] Lisp debugger. One part of Slime resides on the Lisp side, and a larger part resides on the Emacs side as an interface. I worked on a project called Slim-Vim that tried to emulate the interface side of Slime in Vim. We started by integrating a Common Lisp system, ECL[3] into Vim and exposing some of Vim’s functions. Then we could code in Lisp. We managed to get a fair way there before running into painful problems. Vim is not designed to be easily extended. There is a lot of code in there that works in a strange manner (likely for performance/portability reasons), and we basically got stuck.

While working on Slim-Vim I needed to get familiar with what I was trying to provide, so I used Slime on Emacs. To get by while in Emacs, I enabled Viper mode – an Emacs mode that emulates Vi keys. There were a couple of things that I didn’t like about Viper, so I added a couple of functions. It was at this point that I had unknowingly set my path.

Lets look at my programming philosophy over this period of time (6+ months). At the start of the Slim-Vim project, I was very new to Common Lisp and still thinking very much in a C style mindset. The only way of working that I knew was the C way – compile/link/run. As I learned Lisp & tried to make Slim-Vim work I read a lot about software design using Lisp, about how open, extensible and malleable systems[4] are the best way to work. And I agreed, I couldn’t wait to start working with a Lisp system, with a proper editor (Vim) and a good debugger (Slim-Vim) – if only I could get Slim-Vim working.

As I got more disheartened with ever getting Vim to work properly[5], I tinkered with my Viper changes some more. I finally started to grok what these Lispers were talking about. I could edit my Viper changes and instantly test them, instantly see the effects. The open system that I wanted to work with was already right in front of me in the form of Emacs, but I hadn’t seen it! I was looking for something better than C, but it took me 6+ months to really see it. It’s hard to describe, and in-fact I’m not sure that you can really convince people that open systems are better – it is something that you really need to find for yourself.

The second factor for me choosing Emacs is that I want to work with open and dynamic applications. This means you should be able to inspect how the app works, tinker with it, see your results right away. You should be able to live in it. And now that I actually grok that it seems crazy to me to choose to use closed systems.
I used to be a Vim bigot, so I’m sure somebody will say that Vim can do all the things that Emacs can do. Maybe it even can. But it doesn’t have the same feel. If you want to know what an open, malleable, dynamic system is like – use Emacs & write some Emacs Lisp. Trust me, you won’t want to go back.

[1] – http://www.dina.kvl.dk/~abraham/religion/
[2] – http://common-lisp.net/project/slime/
[3] – http://ecls.sourceforge.net/
[4] – I’ll post about open systems in the future.
[5] – If you’ve ever had the misfortune to mess around with Vim’s internals, you’ll probably understand why it is hard to change.

24 Responses to “How a Vim user converts to Emacs”

  1. barrya Says:

    heh heh … it a sweet moment when you finally get it – “…it’s full of stars”

  2. Anonymous Says:

    sigh, vim and cigarettes — two habits that I’ve tried to kick numerous times with absolutely no success. Glad to see there’s hope left for a vim fiend like me. Every time I play with functional languages I wish I started with emacs ( and coincidentally cherish every smoke break ).

  3. Homero Says:

    Who knows maybe one day you try out Squeak and Smalltalk 🙂

  4. Jon Says:

    Do you use viper (or vimpulse) for the keybindings, or have you switched to emacs keybindings?

    I am a big fan of the vi/vim editing model (just see my website), but I totally agree that emacs’ architecture makes much more sense. I just don’t think they’re incompatible.

  5. anonymous Says:

    in summary, all vi users who refuse to convert are idiots.

  6. Mike Seth Says:

    So it consumes you and the ascension to Lisp begins.

  7. Phil D Says:

    Welcome to 1991.

  8. bradbeveridge Says:

    Homero – Smalltalk & Erlang are on my list of languages to try out when I get time.
    Jon – I use vimpulse for the day to day editing stuff & I’m slowly starting to use the less offensive Emacs bindings. One of the biggest wins was mapping ; to M-x 🙂 I don’t think I’ll ever change to a non-modal editing style, but I suspect I’ll eventually find a hybrid style where less frequent commands are the plain Emacs commands & the actual editing is Vi style.
    Phill – 1991 is a lot better than being stuck in the 70’s programming in C like I was previously!

  9. Shii Says:

    Psssh. I use ed, the standard text editor.

  10. Ryan Says:

    I’m currently struggling with viper. Could you post the functions you created somewhere, to benefit monkeys like me?

    Thanks

  11. Andy Says:

    I think your observation can be extended to interpreted (or at least non-compiled) software creation in general. I haven’t had the opportunity to work in lisp recently but I did it for years most of it in the 80s on a Symbolics Lisp Machine whose OS was mostly written in Lisp (editor was emacs as I recall). You could do anything to that system without compiling.*
    I use Matlab now and that’s pretty much the same way: make something and run it without compiling with functions availabe as soon as they are saved.
    What I think most people who haven’t used such a system don’t understand is how much all the extra time compiling+linking, and debugging compiled code (a much more difficult thing) subconciously deters them from changing code to make it better. Who wants to swim another lap in molasses after the first 100? This forms the basis of the RAD concept (Rapid Application Development)

    I think what it comes down to is run-time efficiency vs creating the best product. As computers get faster more more applications can run in interpreted code (of a sort) and speeds sufficient for their requirements and those are good candidates.

    *
    1) I recall you compiled into p-code but you could do that by a key stroke that would tell the system to compile the current function you were editing. At that point it would become the new function of that name available to the system s.t. any other code that was running that had a call to that function of that name would call the new version.
    2) I used to hack the window system all the time as that was all written in Lisp.
    3) I seem to recall that you could set T to Nil and (i.e. reverse the concept of true and false) and crash the machine. I guess you can go too far (-;

  12. bradbeveridge Says:

    Ryan – My key bindings are now based largely on Vimpulse. http://www.emacswiki.org/cgi-bin/wiki/vimpulse.el

    Andy – I fully agree. I have an upcoming post about how C’s compile/link/debug idiom is brain damaged. This dynamic environment is not restricted to non-compiled systems though. SBCL is a Common Lisp that native compiles everything, so when I evaluate (+ 1 2), a small anonymous function is generated & compiled & then executed. SBCL is as fast as C – or it can be.

  13. Mike Says:

    talk to me when you get the frikking META key working on macbooks! If I still have to resort to ESC for meta, why should I convert?

    And believe me I’ve tried.. but they’d rather write useless shit that 90% of the people could care less about, than write something absolutely basic like META key support for at least every major platform?

    And if someone f**KING mentions aquaemacs _one_ more time to me, I’ll reach through the intarwebs and rip their frikking gills out!!!

  14. Dru Nelson Says:

    hey, great story. That sort of thing happens to me all the time.
    I’ve now become self-aware and tend to skip the “let me port their
    good stuff to my good stuff” phase.

    For example, at the begining of the Ruby on Rails wave, I was pretty much
    set on using PHP. I even downloaded the Cake PHP framework and tried
    to work with it. After about a few weeks, I said “what am I doing, just
    go learn Rails … and Ruby at the same time”. What a good call that was.

    BTW, I like Lisp a lot now as well.

  15. ferrari Says:

    “And if someone f**KING mentions aquaemacs _one_ more time to me, I’ll reach through the intarwebs and rip their frikking gills out!!!”

    Mike, you may want to try Aquamacs. Meta key works just fine (like it works great with carbon emacs). And other than that, Aquamacs is like any other GNU Emacs out there.

  16. ford Says:

    Aquamacs is also a lame bastardization of Emacs — set `mac-command-modifier’ to ‘meta instead.

  17. Jon Says:

    To the brave anonymous who wrote this above:

    > in summary, all vi users who refuse to convert are idiots.

    Please document yourself and have a look at this article:

    http://www.viemu.com/a-why-vi-vim.html

    Should help you get a clue on what we’re talking about.

  18. Mason Loring Bliss Says:

    Meta key… Um… Go look at the latest GNU Emacs. The Meta key works nicely.

    GNU Emacs 22.1 supports the Mac out of the box.

    My wishlist for GNU Emacs includes:

    1. Linear undo, ala the Vim default.

    2. XEmacs-like gnuclient, where I can bring up a text frame from Mutt and not have to change to another window to edit my email. (All the in-Emacs clients seem to suck in various ways, and GNU Emacs, while it has a nice terminal, still can’t beat the convenience of screen-running-in-a-terminal yet.) (And yeah, there’s a multi-tty project, but it’s not mainlined yet, and folks say it’s unstable.)

    That said, I keep bouncing off of weirdnesses in Common Lisp and/or various implementations that set me back. This morning I bought a copy of Programming Ruby in protest. Maybe Paul Graham’s ARC will light the way.

  19. cap Says:

    Thanks for this insight, Brad!

    I went a similar path like you before i discovered Viper. I shamelessly linked to this site in http://clfaq.ath.cx , hope you don`t mind. Have a nice day.

  20. Brolin Empey Says:

    I still do not know much about Emacs Lisp nor (Common) Lisp in general, but one of the (X)Emacs features I find most useful is the ability to use function name completion in the M-x minibuffer to find the name of the function I need, then query (X)Emacs to find which keys are bound to this function. There are some functions that I do not use frequently enough to remember to which keys they are bound. I like my approach because it prevents me from having to context switch to reading documentation and the inevitable sidetracking that ensues (I am highly tangential and consequently get sidetracked easily).

  21. On Lisp, Vim, and a whole other bunch of stuff « a modern day haze Says:

    […] then I found this: For many years I thought that the heretics of the Emacs clan [1] were clearly insane – the […]

  22. Brolin Empey Says:

    I have switched from XEmacs to Vim. 🙂

    I got frustrated last month because (X)Emacs never seems to be installed by default on Linux distributions. Vim, or at least a vi-compatible editor, is usually installed, but I did not use Vim enough to remember more than the basics, such as inserting and deleting text using only one buffer. I needed to edit /etc/fstab on a Linux system with only Vim available. This job requires copying and pasting text between at least two buffers. I tried to install XEmacs, but the connection to the Ubuntu package repositories kept timing out. 🙂 I took that as a sign that it was time for a change. The best way to learn is by doing, so since then I have used Vim exclusively. I like Vim so far. Now I will always have an editor I know how to use available. 🙂

  23. Freddy Bob Says:

    Every time I switch from one buffer to another in vim and lose all my undo actions, I go a little bit insane.
    Every time I try emacs to write anything and the *&^*#@%^# TAB key doesn’t work because the numb-nuts who wrote the mode decided that the TAB key shouldn’t work there, I run back to vim. When I try and work out what is going on with the TAB key and find things like ‘hairy mode’ in the documentation, I want to open a vein and not one of mine.
    If vim could forget about keeping compatibility with vim (and ex for fuck’s sake) it would be a lot better.

  24. Jonathan Says:

    Come back to the dark side!

    Like Slime, for Vim

    mwa ha ha ha ha!

Leave a reply to anonymous Cancel reply