sponsor Vim development Vim logo Vim Book Ad

VIlisp.vim : Send Lisp code to a running Lisp interpreter

 script karma  Rating 131/48, Downloaded by 4991    Comments, bugs, improvements  Vim wiki

created by
Larry Clapp
 
script type
utility
 
description
New: 19 May 2008: See also http://theclapp.org/blog/posts/intro_to_lw-vim-mode/ about a partial vi-mode for Lispworks.

New: 1 May 2008: Interested users should check out LIMP at http://mikael.jansson.be/hacking/limp/docs/ and/or vimscript#2219.  Among other improvements, it replaces funnel.pl with screen, which I've thought would be a good idea for a while now but never got around to implementing.

---

VIlisp.vim defines functions and key mappings to send Lisp code to a CMU Common Lisp process running in a separate terminal window.  VIlisp basically automates cut-and-paste from Vim to Lisp.  Vim writes to a FIFO created by a Perl script, funnel.pl.  Funnel takes input from Vim and the keyboard and sends it to Lisp.

I use: Vim v6.3.71, CMU CL 19a-release-20040728 + minimal debian patches, and Perl 5.8.4.  funnel.pl requires the GNU Readline library (4.2 or higher), and Perl modules IO::Pty, Term::ReadLine, and Term::ReadLine::Gnu.  Developed on Debian "sarge" GNU/Linux, kernel 2.6.6.  YMMV.

funnel.pl would probably work with any Lisp that will run in an xterm; just change how it exits Lisp; CMU CL uses "(ext:quit)".  With other minor alterations, it'd probably work with other scrolled-from-the-bottom interpreters (e.g. I've received reports of it working with Octave and R).

Interested users should also see vimscript #165.  I haven't tried it, but from the description, it looks like it might fit the bill.

As of June 2002:

VIlisp.vim also interfaces to your local copy of the Common Lisp HyperSpec (e.g. lookup "defun"), and does Lisp keyword lookups via an included Vim thesaurus file (e.g. expand "with-" into with-accessors, then with-compilation-unit, then with-condition-restarts, etc).

See the README for documentation.
 
install details
Make sure you have GNU Readline (version 4.2 or higher) installed, Perl (at least version 5; I use 5.8.4), and the Perl GNU Readline module installed.

Put this at an appropriate place in your ~/.vimrc:

    autocmd BufRead,BufNewFile *.lsp,*.lisp so ~/path/to/VIlisp.vim

The VIlisp package includes a file called lisp-thesaurus.  Put it in the same directory as VIlisp.vim, and VIlisp.vim will find it.

In an Xterm, run

    export PERL_RL=gnu                  # use GNU readline in funnel
    perl funnel.pl $HOME/.lisp-pipe lisp

In a different xterm, run e.g.

    vim test.lisp

See the README for more extensive configuration information, and for how to configure VIlisp to use your browser to access your local copy of the Common Lisp HyperSpec.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
VIlisp.2.3.tgz 2.3 2005-11-07 6.0 Larry Clapp Fixed funnel.pl crashing when you resize its window.  Changed some mappings (from 'map' to 'nmap' where needed.)
VIlisp.2.2.tgz 2.2 2005-08-28 6.0 Larry Clapp Fixed a minor bug in funnel.pl that kept it from detecting EOF on the tty in some situations.
VIlisp.2.1.tgz 2.1 2005-08-20 6.0 Larry Clapp Fixed problem where if you don't have &hidden or &autowrite, and you have a modified file, and you \es, it deletes most of your buffer.
Fixed some problems with funnel.pl not closing correctly.
VIlisp.2.0.tgz 2.0 2002-06-10 6.0 Larry Clapp - Updated the README.  Added lots of documentation.
- Added looking up keywords in the HyperSpec
- Added a Lisp keyword thesaurus
- changed VIlisp.vim to check for the existence of a BufRead/*.lsp event
VIlisp.1.1.tgz 1.1 2002-04-30 6.0 Larry Clapp - added ^C processing to funnel.pl
- added use of <Leader> in VIlisp.vim mappings
- added a few mappings
    - ,qi -- quit interpreter
    - ,ci -- send ^C to interpreter
- changed wincol() to vircol().  Allows use of "set number"
- use "normal!" instead of "normal" everywhere, so as to avoid clashes with user-defined mappings
- added "stty sane" on exit of funnel.pl.  cmu lisp doesn't need it, but at least one Octave or R user does.
VIlisp.tgz 1.0 2002-02-18 6.0 Larry Clapp Initial upload
ip used for rating: 107.20.121.254

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo