The Vi family of editors (with vim probably being the most frequently used implementation) is almost universally "the other editor" to Emacs. In the Lisp community, however, its use seems rather suppressed due to Emacs's tight connection with Lisp.

Still, there are some vim lispers out there. This page should point them to some ways to make life easier.

Currently the best solution is Slimv by Tamas Kovacs, which attempts to do for Vim what SLIME does for Emacs, including a built in REPL, hyperspec lookup and completion, paredit mode, etc. It is implemented as a filetype plugin and relatively easy to get started with.

Out of the box, [D and [d should work (find definition/jump to definition), as well as [I and [i, but only in the open bufffers.

Some suggestions to vim settings (partly based on articles below). Stuff them to ~/.vim/ftplugin/lisp.vim, and be sure to have :filetype plugin on.

setlocal lisp autoindent showmatch cpoptions-=mp

" Possible folding method
setlocal foldmethod=marker foldmarker=(,) foldminlines=1

" This allows gf and :find to work. Fix path to your needs
setlocal suffixesadd=.lisp,cl path=/usr/src/lisp/**

" This allows [d [i [D [I work across files if you have asdf buffer present.
" If I used load, it would be there too.
setlocal include=(:file\
Exuberant Ctags (comes with Vim) works quite well with Lisp.

Deprecated Tools

Limp by Mikael Jansson used to be the plugin of choice, but is no longer maintained. It uses scripting and GNU screen to integrate a Lisp session and vim/gvim, and is still useful if Slimv doesn't work for you and you can look past a few quirks.

Another recent and noble attempt at getting Vim to talk to slime was slim-vim, which used a vim compiled with ECL to talk to SWANK, just like SLIME. It has now been abandoned.

Previous efforts also include Using vi with Lisp text and VILisp.vim utility. There is also fvl.vim.

Other things to describe/do:

  • Fix system to recognize asdf files as lisp file (either change filetype.vim, or add autocommands to your vimrc file)
  • How make CLHS into file to be used as jump tags (attempt at in the Limp repos).

Categories: development