| Contact: | Limp User for help/comments
(subscribe to limp-user)
Limp Development for patches/hacking
(subscribe to limp-devel)
|
|---|---|
| Web: | Download Limp (Vim.org)
Limp Bug Tracker and Documentation (Mikael.Jansson.be)
|
| IRC: | #limp on irc.freenode.net (I'm logged in as tic)
|
| Date: | $Date: 2008-06-12 00:28:50 -0700 (Thu, 12 Jun 2008) $ |
| Author: | Mikael Jansson |
Limp's goal is to provide a compelling alternative to SLIME for Vim.
Features include:
Limp is now a filetype plugin. If you're using 0.3.2 or earlier, you need to remove your old installation of Limp, i.e.:
$ rm -rf ~/.vim/plugin/limp.vim $ rm -rf ~/.vim/limp
then proceed with the installation as described below.
Limp relies on a few application and packages.
These are easily installable on Debian-based systems such as Ubuntu:
$ sudo aptitude install vim-full sbcl hyperspec rlwrap screen perl
Unpack the archive, change to the newly created directory and run the installation script:
$ sudo ./install.sh
This will install Limp in /usr/local/limp/0.3.4, symlink it to latest in the same directory, and finally make a symlink in your Vim configuration directory's ftplugin/lisp (creating it if it doesn't already exist) pointing to latest Limp.
Unless installed in /usr/local/limp/0.3.4, Limp needs to have the variable $LIMPRUNTIME pointing to the base directory, so add this to your ~/.bash_profile (or equivalent settings file for your shell):
export LIMPRUNTIME=/path/to/limp/0.3.4
Place 0.3.4 in the directory pointed out by $LIMPRUNTIME and setup the following symlinks:
$ ln -sf $LIMPRUNTIME/vim $HOME/.vim/ftplugin/lisp/limp $ ln -sf limp/limp.vim $HOME/.vim/ftplugin/lisp/limp.vim
Finally, generate the Lisp thesaurus:
$ cd $LIMPRUNTIME/bin $ ./make-thesaurus.sh
I've included a nifty color scheme, for 256-color-capable terminals: 0.3.4/vim/desert256.vim. Copy it to your $HOME/.vim/colors directory.
If you're planning on using the command line tool lisp.sh to list/boot/connect to Lisp listeners outside of Vim, make a symlink like this:
$ ln -sf /usr/local/limp/0.3.4/bin/lisp.sh /usr/local/bin
This should get you going with Limp!
Vim started with a simple hello-world program.
Press <F12> and Enter to start a new Lisp.
Press <F12> again to go to the listener.
Press <F12> to return to Vim.
Looking at the listener, you see that the code you just sent has been compiled.
Let's add more code inside the function definition. With the cursor in the middle of the newly added form, you can now press \ec (Evaluate Current form) to send only what's currently highlighted.
And here you can see the results.
We can also evaluate arbitrary expressions, such as looking at a symbol, using \ex (Evaluate eXpression) and typing something at the prompt, followed by enter to send it.
Yes, it is indeed a symbol.
Let's remove that extra line of code in the function, and add a docstring describing the function. Send the definition to Lisp with \et.
With the cursor on the word say-hello, we now press \hd (Help Describe) to get detailed information from Lisp about the symbol.
This is what our Lisp believes SAY-HELLO to be.
If we exit Vim, our Lisp is still active. You can attach from it directly from the command line, or from another Vim session.
You can save your Lisp's state and later restore it. Very handy.
Here, I've booted up a fresh Lisp and evaluated the function definition. Then, <Shift-F12> asks for the path of a file to save the core in. The Lisp core is now frozen in time.
I quit Vim and opened up a completely empty file, empty.lisp, to really point out that I will not evaluate any code from the Lisp file. Press <F12>, Enter, name it "test", Enter and Limp then asks for a core to boot. Here, input the core we just saved.
With the core booted, we should have the function say-hello available.
Yup. Nice!
Example 1:
(defun fib (n)
; ^ cursor here
(cond ((or (= n 0)
(= n 1)) 1)
(t (+ (fib (- n 1))
(fib (- n 2))))))
With the cursor at the indicated spot, "K" (see below) will invoke your browser with file://localhost/path/to/hyperspec/Body/m_defun.htm#defun. This may require some configuration of a Perl script, limp-hyperspec.pl. See below.
Example 2:
with- ; ^ cursor here
With the cursor at the indicated spot, "hp" (see below) will invoke your browser with the address of a freshly built index of links to:
with-accessors with-compilation-unit with-condition-restarts with-hash-table-iterator with-input-from-string with-open-file with-open-stream with-output-to-string with-package-iterator with-simple-restart with-slots with-standard-io-syntax
Limp uses a Perl script, limp/bin/limp-hyperspec.pl, for invoking a browser with the documentation. I use Opera (www.opera.com), so Limp comes comes pre-configured to use it. I've done some testing with Lynx and Netscape, so uncomment those lines to try those browsers. I haven't gotten Konqueror to work to my satisfaction; if you do, please drop me an e-mail.
There are a few configuration parameters you can set in the file to modify the default browser and such.
Array of string arguments to your browser. Opera's "new-page" argument to openURL gives each set of HyperSpec search results a new page. Other browsers may have analogous flags, and similar behavior.
limp-hyperspec.pl replaces %s in @browser_args with the URL to be opened. See the Opera configuration for an example.
The script requires you to have a local copy of the HyperSpec. It searches $BASE/Front/X_Perm_*.htm to find the symbols you want it to look for. You can find a tarball of the CLHS at http://www.xanalys.com. If you use Debian or a derivative, such as Ubuntu, apt-get install hyperspec will put the HyperSpec in /usr/share/doc/hyperspec. limp-hyperspec.pl looks for it there, by default.
Limp can complete the names of symbols. They tend to be rather long, so it's a useful thing.
First, type this in Vim...
Then, hitting ^N (Ctrl-N) will expand least- into least-negative-long-float first, then (with another ^N) least-positive-long-float, then least-negative-short-float, and so on.
There's a convention to talk about dashed names by abbreviating them into the first letter of each word, e.g.:
First, type this in Vim...
Then, hitting ^N^N (Ctrl-N twice) will expand the p-n to package-name. ^N again will replace package-name with pathname-name, and ^N yet again will replace that with pprint-newline. See Vim help for complete, compl-generic, and i_CTRL-X_CTRL-T. Also, see below for notes on this facility.
Finally, you should install SuperTab and and use that instead of the default keys used for completion!
Limp defines a buffer-level command, :Eval.
:Eval <sexp> will evaluate an s-exp, e.g.:
:Eval (format t "Hello, world!~%")
Limp mode is automatically set when evaluating the following:
:set filetype=lisp
Useful for editing files not automatically detected as Lisp files (such as .asd-files, $HOME/.sbclrc, etc.)
The default behaviour when running gvim is to open an xterm. There are two flags you can adjust:
The default settings in Limp. All bindings can be easily changed in /path/to/limp/0.3.4/vim/keys.vim.
The rest of the bindings assumes <LocalLeader> == "\", which is the default. Some people prefer let maplocalleader = ",".
This is a regular screen session. Escape is <Ctrl-z>, and <F12> is mapped to detach (<Ctrl-z> d).
For sending code to a Lisp.
Source transformation.
Vim interaction.
Looks things up in the HyperSpec, by opening a browser pointing to a local copy of the HyperSpec.
Moreover, K works as expected, doing an exact matching.
When typing an opening bracket, paren or double-quote, it automatically adds the closing bracket. You can now either type the closing symbol yourself or skip it altogether. Backspacing over it removes the pair.
Depending on your keyboard preferences, you might have to press Cmd-(Shift-)F12. Also, Ctrl-F12 seems to be chomped by the system, so you'll have to change vim/limp.vim to use something else than <C-F12> for disconnect. (Or, you can simply quit Vim; that'll have the same effect.)
Also, if Vim doesn't say you're connected after booting Lisp, you might have to set the proper location to SBCL/SBCL_HOME in bin/lisp.sh.
Vim comes with support for a few useful things out-of-the-box. You should try these out:
Exuberant Ctags works perfectly well for Lisp source code, so you can use the tag system to navigate in your Lisp source code. For non-US keyboards, the default keybinding can be impossible to type in. Here's a better mapping, <Ctrl-Space> (... which generates C-@):
map <C-@> <C-]>
2008-04-21 by Mikael Jansson <mail@mikael.jansson.be>
Internal release