VIlisp.vim : Send Lisp code to a running Lisp interpreter
| script karma
Downloaded by 4939
Comments, bugs, improvements
script versions (upload new version)
|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.
|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.
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.
Click on the package to download.
ip used for rating: 220.127.116.11
||Fixed funnel.pl crashing when you resize its window. Changed some mappings (from 'map' to 'nmap' where needed.)
||Fixed a minor bug in funnel.pl that kept it from detecting EOF on the tty in some situations.
||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.
||- 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
||- 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.