Using Vim for Lisp development

VimIdeLispCommon Lisp

Vim Problem Overview


I've been using Lisp on and off for a while but I'm starting to get more serious about doing some "real" work in Lisp. I'm a huge Vim fan and was wondering how I can be most productive using Vim as my editor for Lisp development. Plugins, work flow suggestions, etc. are all welcome.

Please don't say "use emacs" as I've already ramped up on Vim and I'm really enjoying it as an editor.

Vim Solutions


Solution 1 - Vim

Limp aims to be a fully featured Common Lisp IDE for Vim. It defaults to SBCL, but can be changed to support most other implementations by replacing "sbcl" for your favourite lisp, in the file /usr/local/limp/latest/bin/lisp.sh

When discussing Lisp these days, it is commonly assumed to be Common Lisp, the language standardized by ANSI X3J13 (see the HyperSpec, and Practical Common Lisp for a good textbook) with implementations such as GNU Clisp, SBCL, CMUCL, AllegroCL, and many others.

Back to Limp. There are other solutions that are more light-weight, or try to do other things, but I believe in providing an environment that gives you things like bracket matching, highlighting, documentation lookup, i.e. making it a turn-key solution as much as possible.

In the Limp repository you'll find some of the previous work of the SlimVim project, namely the ECL (Embeddable Common Lisp) interface, merged with later releases (7.1); Simon has also made patches to 7.2 available yet to be merged. The ECL interface is documented in if_ecl.txt.

Short-term work is to do said merging with 7.2 and submit a patch to vim_dev to get it merged into the official Vim tree.

Which leads us to the long-term plans: having Lisp directly in Vim will make it convenient to start working on a SWANK front-end (the part of SLIME that runs in your Lisp, with slime.el being the part that runs in the editor - the frontend).

And somewhere in between, it is likely that all of Limp will be rewritten in Common Lisp using the ECL interface, making Limp easier to maintain (VimScript isn't my favourite) and being easier for users to customize.

The official Limp site goes down from time to time, but as pointed out, the download at Vim.org should always work, and the support groups limp-devel and limp-user are hosted with Google Groups. Don't hesitate to join if you feel you need a question answered, or perhaps even want to join in on development. Most of the discussion takes place on the limp-devel list. If you're into IRC, I'm in #limp on irc.freenode.net as 'tic'.

Good luck!

Solution 2 - Vim

You might give slimv a break.

Solution 3 - Vim

Here's a cool diagram by Xach that sums up the current situation.

diagram explaining that there are nearly no VIM users that are also Lisp programmers and can also hack it to make it a good Lisp IDE... lousy alt text :)

Solution 4 - Vim

Here we are 9 years later, and now we have Vim 8 and Neovim, both providing the ability to interact with plugins asynchronously.

vlime is an excellent, feature-rich plugin that takes advantage of the new async interface to provide a SLIME-like dev environment for Common Lisp.

Solution 5 - Vim

Solution 6 - Vim

SLIME for EMACS is a wonderful tool for LISP programming. The best part is sending code written in your editor straight to a live LISP session. You can get similar behavior out of Vim using the tips here:

http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/

I adjusted my own script so that I can send to either a SBCL or Clojure session. It makes you much more productive and takes advantage of the REPL.

":set lisp" starts the lisp indentation mode for Vim. But it won't work with some dialects like Clojure. For Clojure, use VimClojure.

Some people like LIMP also.

Solution 7 - Vim

  • Vim add-ons: Rainbow Parentheses, Lisp syntax

  • SBCL add-ons: rlwrap, sb-aclrepl

  • Workflow: Ion3 (or some other tiled WM) with multiple terminal windows.

    • Edit Lisp in Vim
    • Switch to Lisp window (using the keyboard of course)
    • Use C-r to recall the line to reload the ASDF system in question so your changes become active.
    • Use X Window copy/paste for small snippets/changes.
    • Use DESCRIBE, TRACE and APROPOS heavily.
    • Repeat.

Solution 8 - Vim

:set lisp

Vim has a mode to help you indent your code by Lisp standards.

Also, I modify the lispwords to change how vim indents my code.

:setl lw-=if (in ~/.vim/ftplugin/lisp.vim)

Solution 9 - Vim

You can give Emacs with Vim emulation a try, is not perfect, but it may be somewhat familiar. I think Lisp shines if you use something like Slime or DrScheme doing iterative development, all other editors feel just wrong.

Solution 10 - Vim

There seem to have been attempts at having a SLIME-like integration of Lisp in Vim, but none have really gone as far as needed to be really useful. I think ECL's integration has been done, though, but not committed upstream.

You should find all relevant links from Cliki's page about Vim.

Solution 11 - Vim

I know you said not to tell you to use Emacs.

Use Emacs.

Serious, the http://common-lisp.net/project/slime/">SLIME</a> setup for Emacs is pretty much the standard development platform for Lisp, and for very good reason.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDrew OlsonView Question on Stackoverflow
Solution 1 - VimMikael JanssonView Answer on Stackoverflow
Solution 2 - VimosdfView Answer on Stackoverflow
Solution 3 - VimLuís OliveiraView Answer on Stackoverflow
Solution 4 - VimDave YarwoodView Answer on Stackoverflow
Solution 5 - VimBen HoffsteinView Answer on Stackoverflow
Solution 6 - VimBrianView Answer on Stackoverflow
Solution 7 - VimLeslie P. PolzerView Answer on Stackoverflow
Solution 8 - VimgraywhView Answer on Stackoverflow
Solution 9 - VimpupenoView Answer on Stackoverflow
Solution 10 - VimNowhere manView Answer on Stackoverflow
Solution 11 - VimKirk StrauserView Answer on Stackoverflow