1. Tamas Kovacs
  2. slimv


slimv / description.txt

Script name

          1         2         3         4         5         6         7

SLIME-like Lisp and Clojure REPL inside Vim with Profiling, Hyperspec, Paredit

Slimv tries to mimic a subset of SLIME's (Superior Lisp Interaction Mode for Emacs) functionality inside Vim on Linux and Windows. The script defines functions and keybindings to send s-expressions to a console mode Lisp or Clojure REPL (Read-Eval-Print Loop). Slimv runs its own REPL or connects to a running REPL started by a previous Slimv session, the connection is established when the first Slimv command is executed (e.g. an s-expression is evaluated).

The Lisp REPL buffer can also be opened inside Vim as a Vim buffer with syntax highlighting and autoindenting, Lisp commands may be entered in the command line, just as in a regular REPL. The script also has a basic support for Clojure REPL.

Slimv supports the same profiling tool that comes with SLIME. The script also has a Common Lisp Hyperspec lookup feature and it is able to lookup symbols in the Clojure API, as well as in JavaDoc. Symbol name completion is supported via Vim's omni-completion based on the hyperspec symbol database.

Slimv comes with Paredit Mode, which is similar to the functionality of paredit.el in Emacs. Paredit Mode tries to maintain the balanced state of matched characters (parenthesis marks, square brackets, double quotes). Matched characters are inserted and removed in pairs, also when working with a block of text (well, mostly). Slimv also implements many paredit.el s-expression handling functions, like Split/Join/Wrap/Splice. Slurpage and Barfage known from Emacs is also possible but in a different fashion: you don't move the list element in or out of the list, rather you move the opening or closing parenthesis over the element or sub-list.

Check out the screenshot of Slimv having a clisp REPL buffer:

Another screenshot of Slimv running the Clojure Ants demo:

And this is the symbol name completion in action (no, the pink background is not done by Slimv, this is Vim's default):

Here follows a list of Slimv commands, any similarity with SLIME's menu is not coincidental. :)
For a more complete description with keybindings see the included documentation.

Edit commands:
    *  Close Form
    *  Complete Symbol
    *  Paredit Toggle

Evaluation commands:
    *  Eval Defun
    *  Eval Last Expression
    *  Pprint Eval Last Expression
    *  Eval Region
    *  Eval Buffer
    *  Interactive Eval
    *  Undefine Function

Debug commands:
    *  Macroexpand-1
    *  Macroexpand
    *  Trace
    *  Untrace
    *  Disassemble
    *  Inspect

Compile commands:
    *  Compile Defun
    *  Compile and Load File
    *  Compile File
    *  Compile Region

Profile commands:
    *  Load Profiler
    *  Profile
    *  Unprofile
    *  Unprofile All
    *  Show Profiled
    *  Profile Report
    *  Profile Reset

Documentation commands:
    *  Describe Symbol
    *  Apropos
    *  Hyperspec
    *  Generate Tags

REPL commands:
    *  Connect to Server
    *  Send Input
    *  Interrupt Lisp Process
    *  Close and Send Input
    *  Previous Input
    *  Next Input

Many Slimv commands operate on s-expressions or symbols, just like in SLIME. Place the cursor at any location inside the s-expression or on the symbol's name then invoke the command. This builds a command specific form and sends it to the running REPL for evaluation.

For more information see the documentation coupled with the script, please refer to section "External Utilities" for other useful Lisp editing tips not covered by Slimv.
Installation details
Note for users of pre-0.5.0 versions: Slimv is now a Lisp+Clojure filetype plugin, which means that it went through a major reorganization. Please delete the old version before installing the new one. See details in the documentation.

Extract the zip archive into your vimfiles or runtime directory. The archive contains the following files:
    *  doc/slimv.txt
    *  ftdetect/clojure.vim
    *  ftplugin/metering.lisp
    *  ftplugin/slimv.py
    *  ftplugin/slimv.vim
    *  ftplugin/slimv-clhs.vim
    *  ftplugin/slimv-cljapi.vim
    *  ftplugin/slimv-javadoc.vim
    *  ftplugin/clojure/slimv-clojure.vim
    *  ftplugin/lisp/slimv-lisp.vim
    *  indent/clojure.vim
    *  plugin/paredit.vim
    *  syntax/clojure/slimv-syntax-clojure.vim

Slimv works on Windows and on Linux, Cygwin is not supported. The script requires the following programs installed on your system:
    *  Lisp (any console Common Lisp should be OK) or Clojure
    *  Python 2.4 or later
    *  Pywin32 is recommended on Windows
Slimv tries to autodetect your Lisp/Clojure and Python installation directories. If it fails to determine the correct directories, then you need to enter path definitions into your vimrc file:
    let g:slimv_python = 'C:/MyPythonDir/python.exe'
    let g:slimv_lisp = 'C:/MyLispDir/mylisp.exe'

Should the autodetection for Clojure fail, set the Lisp path to the complete Clojure REPL startup command, something like:
    let g:slimv_lisp = '"java -cp /myclojuredir/clojure.jar clojure.main"'

Linux users using terminal emulator other than xterm should define the complete command to run the Slimv client + server. Here follows an example with konsole and clisp:
    let g:slimv_client = 'python ~/.vim/plugin/slimv.py -r "konsole -T Slimv -e @p @s -l clisp -s"'

See the included documentation for more complete installation and customization instructions.

Script versions

0.6.1: Added Split/Join/Wrap/Splice functions to Paredit Mode, bugfixes: delete commands put erased characters into yank buffer, D does not delete whole line.

0.6.0: Added paredit mode, set wrap for REPL buffer.

0.5.6: Improved REPL buffer response time, added debug log flushing frequency, bugfix: early exit of REPL refresh mode on some machines.

0.5.5: Updated Clojure API to 1.1, expand tilde-prefix to home directory on Linux, autodetect Clojure in the user home directory on Linux. 

0.5.4: Added autodetection for clojure-contrib.jar and Clozure CL, applied lisp_rainbow to Clojure's [], renamed Clojure indent plugin to clojure.vim, switched on lisp indentation for Clojure files. 

0.5.3: Added Interrupt-Lisp-Process command, added mapping for the REPL menu, added special forms to Clojre API lookup, bugfixes: put cursor after the last character in insert mode when refreshing REPL buffer, fixed some Ctrl-C handling problems.

0.5.2: Adapted Clojure API lookup and autodetection to version 1.0, Complete-Symbol moved to separate Edit submenu, added Close-Form command.

0.5.1: Added symbol name completion based on the Hyperspec database.

0.5.0: Major project reorganization: Slimv is now a Lisp and Clojure filetype plugin, added Common Lisp Hyperspec, Clojure API and JavaDoc lookup, separate menu for REPL buffer, menu items work in every Vim mode, fixed mark 's usage bug.

0.4.1: Added profiler support for SBCL, new commands: Show Profiled/Send Input/Close and Send Input/Previous Input/Next Input, highlight error messages.

0.4.0: Added SLIME's profiling tool with support from Slimv, added command to generate tags file, fixed eval problems of large buffers, fixed Compile And Load filename problems with '\' on Windows, recycle old REPL temporary file at next server startup.

0.3.0: REPL buffer enhancements: added syntax highlighting and automatic indentation, it is possible to enter a multi-line command, Ctrl-C is working; server REPL window performance enhancement on Linux.

0.2.2: Fixed REPL input and output mix-up problems, evaluation performance enhancement, corrected some more macroexpand problems. 

0.2.1: Added basic Clojure support, fixed some macroexpand and REPL refresh problems.

0.2.0: Major update: Lisp REPL inside a Vim buffer.

0.1.4: Corrected the delayed display of last line in REPL window on Linux.
       Ctrl+C is propagated to Lisp REPL, so it is possible to interrupt a running program.

0.1.3: Handle DOS and Unix style line endings on Windows, don't write logfile when debug level not set


Hi Reddit! I have just added Paredit Mode to my Slimv (Superior Lisp Interaction Mode for Vim) script. I submitted this to both /r/lisp and /r/Clojure because the script works for these languages. Paredit Mode for Vim is similar to how paredit.el works for Emacs: matched delimiters are added or removed in pairs, so that the balanced state of parens are maintained. It is also possible to use Paredit Mode alone, without the other Slimv functionalities, please find details in the script documentation. I hope you'll find it useful.

Lisp with Vim: a script that tries to mimic a subset of SLIME's functionality.

Lisp and Clojure REPL inside a Vim buffer: Major update to the Slimv script.

Lisp and Clojure REPL inside a Vim buffer: The Slimv script comes now with Profiling and Hyperspec lookup.

Lisp and Clojure REPL inside Vim with profiling and Hyperspec lookup: update to the Slimv script.



- REPL buffer refresh on Vim focus gain works only in gvim, not in console vim
- REPL buffer refresh sometimes does not work first time after the server Lisp windows was just opened
- Ctrl+C works in server Lisp window (but only in Lisp implementations that support it, so not in SBCL)


File list