Vim + screen + REPL = win

Via the Clojure wiki I found a great page describing how you can use GNU screen and some Vim magic to let Vim play nicely with an interactive commandline program like a Common Lisp REPL, Ruby's irb, or Python's, well, python.

That page is a very stripped-down and simpler version of what Limp does for Vim+Lisp. But Jonathan Palardy's version has the benefit of being so simple that you can set it up yourself manually in a second or two. I still have never gotten Limp to work quite right and I don't have the time to debug a big mess of Vim script.

The idea is to start up a named screen session via e.g. screen -S foo -t bar, then start an irb session (or whatever) in there, and then in Vim you can simply yank some text into a named register and send it off to screen via a system call. Download Jonathan's code and see.

It's not a full-blown SLIME; it doesn't have tab-completion or weird interactive debugging windows or such bullcrap. It doesn't capture the output of your command and feed it back into your Vim buffer. But hey, it's pretty good for something you can throw together in 2 minutes, and it works.

So there goes my last reason to ever use Emacs. Good riddance, I must say.

Honestly, Emacs just frustrates the living hell out of me. Oh how I tried to like it. I really did. I've used it on and off constantly over the past year. I have Emacs shortcuts written all over the whiteboard in my office. But its braindead window management, its terrible broken undo/redo system, its finger-crippling key-chord combos, its lack of features I need (like line numbering), its reliance on broken 3rd-party elisp hack scripts for things Vim has built in (like line numbering!), its ugly fonts and GUI elements, and so on and so forth. Vim is such a joy in comparison.

7 Responses to “Vim + screen + REPL = win”

  1. Quoth Citizen Bleys:

    What the devil is a SLIME?

  2. Quoth Asgeir:

    Superior Lisp Interaction Mode for Emacs, http://en.wikipedia.org/wiki/SLIME
    'cause vim will never be a good Lisp editor.

  3. Quoth raja:

    “It's not a full-blown SLIME; it doesn't have tab-completion or weird interactive debugging windows or such bullcrap.”

    Yeah, cause who wants to debug and get work done and other such bullcrap…

  4. Quoth Jules:

    I use this method too. It's two parts: (1) a program called `slime` that starts a command in screen. Like `slime irb`. (2) a keybinding in Vim that sends the current paragraph (or selection if you are in visual mode) to screen. It's is just 2 lines of code + 1 line for the `slime` program. Probably the most useful three lines ever.

    Funny that you think that undo is broken in Emacs. Emacs' undo is the #2 thing I miss in Vim (#1 being the kill ring).

  5. Quoth Greg:

    You can get a kill-ring in vim with the YankRing.vim plugin. Very useful indeed!

    http://www.vim.org/scripts/script.php?script_id=1234

  6. Quoth anonymous coward:

    “I've used it on and off constantly”

    Well, I have to say, that's one of the more interesting oxymorons I've ever read…

  7. Quoth Brian:

    *bows*

Leave a Reply

You can use these tags in comments (Note: HTML is automatically escaped inside <pre> tags, nowhere else, so if you post source code, put it in <pre>):

<pre lang="some_programming_language"> 
<em>
<strong>
<a href="url">

NOTE: Comments are automatically spam-filtered. If your comment fails to appear, it was likely munched by the filter. Try not to link-spam or post anything that looks like it was typed by a robot.