This is a read-only archive!

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.

September 05, 2008 @ 5:36 PM PDT
Cateogory: Programming

9 Comments

Citizen Bleys
Quoth Citizen Bleys on September 05, 2008 @ 6:30 PM PDT

What the devil is a SLIME?

Asgeir
Quoth Asgeir on September 05, 2008 @ 7:01 PM PDT

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

raja
Quoth raja on September 05, 2008 @ 7:58 PM PDT

"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...

Jules
Quoth Jules on September 05, 2008 @ 8:24 PM PDT

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).

Greg
Quoth Greg on September 05, 2008 @ 10:15 PM PDT

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

anonymous coward
Quoth anonymous coward on September 06, 2008 @ 5:48 AM PDT

"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...

Brian
Quoth Brian on September 06, 2008 @ 5:56 AM PDT

bows

Bart J
Quoth Bart J on July 02, 2009 @ 6:10 AM PDT

I am trying to setup REPL using vimclojure but without any success. Can you please help?

Thanks in advance.

Brian
Quoth Brian on July 02, 2009 @ 7:57 AM PDT

I've actually never used vimclojure. :( I've defected back to SLIME for my Clojure needs. If you ask on the Clojure mailing or in the Clojure IRC channel list I think you will get some help. There are some vimmers in both places.