dgrnbrg / vim-redl

A better Vim integration story for Clojure
106 stars 8 forks source link

Redl.vim -- Read Eval Debug Loop

This plugin integrates Vim with a running Clojure JVM. It provides a repl that supports breakpoints, documentation lookup, source code navigation, and omnicompletion.

Installation

Vim Redl depends on fireplace.vim. Please install fireplace first.

First, you'll need to install this as a Vim plugin. Do that with

cd ~/.vim/bundle
git clone git://github.com/dgrnbrg/vim-redl.git

You'll need Pathogen so that vim-redl gets loaded. Otherwise, if you are a user of Vundle or NeoBundle, you can just use Plugin 'dgrnbrg/vim-redl' or NeoBundle 'dgrnbrg/vim-redl' respectively to install the Vim component.

Then, you'll need to install the Clojure component. To get this, you just need to add 2 lines to your ~/.lein/profiles.clj.

A minimal profiles.clj (including REDL, Spyscope, and lein pprint) would look like:

{:user {:dependencies [[spyscope "0.1.3"]
                       [redl "0.2.4"]]
        :injections [(require 'spyscope.core)
                     (require '[redl complete core])]}}

A REPL

To access the other repl, use :Repl or :ReplHere. The former opens a new split window containing a repl in the namespace user. The latter opens the repl in the namespace of the current file.

To open this repl in a vertical split (rather than horizontal), you can set this option in your .vimrc:

let g:redl_use_vsplit = 1

The default controls for the repl are:

If some of these key bindings don't work on your machine, you can try to redefine them in your .vimrc. For example, to bind moving up in the history to Ctrl-Shift-K:

imap <silent> <C-S-K> <Plug>clj_repl_uphist.

To change other key bindings, the plugs for the repl are:

<Plug>clj_repl_enter.
<Plug>clj_repl_eval.
<Plug>clj_repl_hat.
<Plug>clj_repl_Ins.
<Plug>clj_repl_uphist.
<Plug>clj_repl_downhist.

To use the breakpoint feature, check out dgrnbrg/redl (short version: (redl.core/break), and then (redl.core/continue) in the debug sub-repl).

Omnicomplete

This feature requires redl to be loaded in the connected JVM, as this plugin uses redl's advanced fuzzy completion engine.

Contributing

Please, open GitHub issues for bug reports and feature requests. Even better than a feature request is just to tell me the pain you're experiencing, and perhaps some ideas for what might eliminate it.

This plugin was made by borrowing generous amounts of code from vimclojure Meikel Brandmeyer.

License

Copyright © David Greenberg, Tim Pope, and Meikel Brandmeyer. Distributed under the same terms as Vim itself. See :help license.