Multiple Lisps from Vim

In topic Miscellaneous :: Published Saturday, April 19, 2008

I've made a few modifications to Larry Clapp's excellent ViLisp plugin to let you specify the Lisp process you want to connect to. This lets you have multiple Lisps running simultaneously and communicate with them using Vim.

Update
2008-08-19: Made a typo changing the file ViLisp.vim, so the thesaurus (e.g. m-v-b <Complete> => multiple-value-bind) wouldn't work. Swap the two lines with ViLisp_location and thesaurus, or download the new archive.

Usage

Split up in two parts, a shell file starting the Lisp listener, and a set of Vim bindings and a plugin.

Starting Lisp

Either you give it a name in the command line:

$ lisp.sh foo
*** Lisp listener at /home/mikael/.sbcl-pipe_foo

This is SBCL 1.0, an implementation of ANSI Common Lisp.
...

or at the interactive prompt:

$ lisp.sh
Lisp name? (blank for 1037)
test
*** Lisp listener at /home/mikael/.sbcl-pipe_test

This is SBCL 1.0, an implementation of ANSI Common Lisp.
...

or not at all:

$ lisp.sh
Lisp name? (blank for 1076)

*** Lisp listener at /home/mikael/.sbcl-pipe_1076

This is SBCL 1.0, an implementation of ANSI Common Lisp.
...

which will give you the PID of the script.

/static/2008/04/terminal-lisp.png

Inside Vim

Except for changing the commands to work better with SBCL (<Leader>qi now send (sb-ext:quit) instead of (quit), and similar), few things are added.

/static/2008/04/terminal-vim-lisp.png
<Leader>lisp
Connect to the running Lisp. You'll be prompted to complete the filename (tab completion is active).
<Leader>d
Sends (describe 'word-under-cursor) to the running Lisp.
/static/2008/04/terminal-lisp-sent.png

Here's what it looks like after sending (<Leader>es) our hello world to the running Lisp.

Installation

Download and unpack mjbe-vilisp-20080419.tar.gz.

You'll have a directory, mjbe-vilisp-20080419, with the following files:

  • dot-vim/lisp/vilisp/
    • ViLisp.vim, replacing the original file in the ViLisp distribution
  • dot-vimrc, containing additions you're advised to make to your ~/.vimrc
  • local/bin/
    • lisp.sh, for starting a Lisp listener. Uses the original distribution's vim-to-lisp-funnel.pl

Happy Vimming!


Responses

You can follow any responses to this entry through the RSS 2.0 feed.

  1. w-g said on April 19th, 2008 at 16:11 (link)

    That’s a nice job!

    Larry stopped working on VILisp some time ago… Maybe you would like to take over?

  2. Mikael Jansson said on April 19th, 2008 at 18:26 (link)

    Thanks!

    I probably won’t assume ownership, but I’m considering publishing patches against ViLisp and HiMtchBrkt (second screenshot) in an organized fashion so others can enjoy my square wheels!

If this is the first time you comment on my site, your post might get held up in the moderation queue. Don't panic, I'll approve it as soon as possible!

Code (i.e. literal) blocks should be wrapped inside <PRE>.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Close
Powered by ShareThis