Today I found the awesomeness that is vim-slime, it's been an exciting day for me. Slime is the "The Superior Lisp Interaction Mode for Emacs", I can almost hear the emacs crowd laughing.

For those that use vim and haven't used Slime, vim-slime or something similar, this is why it's awesome:

Text can be sent from any process to the stdin of a gnu screen or tmux session. The process in this case is vim and the screen/tmux session is a terminal.

Screen is a really neat terminal multiplexer (you can run multiple terminals in a terminal window). The multiplexed shell processes are children of the screen process, which itself is not a child of the terminal window process. This means a screen process and its child processes keep running if you close the terminal window. Later you can re-connect to it, this is what makes vim-slime possible.

Here is an screen shot, on the left is me in gVim writing some awful Clojure [1]. On the right is a screen buffer in which I started a Clojure REPL. When I want to try run some code I can send any vim text selection to the REPL in a keystroke (or two).

vim slime screenshot

It doesn't have to be a Clojure REPL either, we can send anything to a screen shell. We could run git commands, find, grep, sed, etc. Like with the Clojure REPL we can even interact with any terminal programs that use STDIN.

This concept can be taken even further, You can even connect to a tmux session over SSH and share a terminal or a terminal program like vim to do remote pairing!

Hopefully remote pairing is the topic of my next post as there are a couple geographically distant people I know who are keen to do some pair hacking. I stand to learn a lot!

[1] I learnt almost everything I know about Lisp from The Little Schemer. Great book.