There's a REPL in fireplace, but you probably wouldn't have noticed if I hadn't told you. Such is the way with fireplace.vim. By the way, this plugin is for Clojure.
First, set up cider-nrepl. (If you skip this step, fireplace.vim will make do with eval, which mostly works.) Next, fireplace.vim doesn't provide indenting or syntax highlighting, so you'll want a set of Clojure runtime files if you're on a version of Vim earlier than 7.4. You might also want leiningen.vim for assorted static project support.
If you don't have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:
cd ~/.vim/bundle git clone git://github.com/tpope/vim-fireplace.git
Once help tags have been generated, you can view the manual with
This list isn't exhaustive; see the
:help for details.
Fireplace.vim talks to nREPL. With Leiningen, it connects automatically based
.nrepl-port, otherwise it's just a
:Connect away. You can connect to
multiple instances of nREPL for different projects, and it will use the right
one automatically. ClojureScript support is just as seamless with
The only external dependency is that you have either a Vim with Python support
compiled in, or
python in your path.
Oh, and if you don't have an nREPL connection, installing leiningen.vim
lets it fall back to using
java clojure.main for some of the basics, using a
class path based on your Leiningen config. It's a bit slow, but a two-second
delay is vastly preferable to being forced out of my flow for a single
command, in my book.
Not quite a REPL
You know that one plugin that provides a REPL in a split window and works absolutely flawlessly, never breaking just because you did something innocuous like backspace through part of the prompt? No? Such a shame, you really would have liked it.
I've taken a different approach in fireplace.vim.
cq (Think "Clojure
Quasi-REPL") is the prefix for a set of commands that bring up a command-line
window — the same thing you get when you hit
q: — but set up for Clojure
cqq prepopulates the command-line window with the expression under the
cqc gives you a blank line in insert mode.
Evaluating from the buffer
Standard stuff here.
:Eval evaluates a range (
:%Eval gets the whole
:Require requires a namespace with
:reload-all), either the current buffer or a given argument.
(clojure.test/run-tests) and loads the results into the quickfix
cp operator that evaluates a given motion (
cpp for the
innermost form under the cursor).
c1m are similar, but they only
macroexpand-1 instead of evaluating
the form entirely.
Any failed evaluation loads the stack trace into the location list, which
can be easily accessed with
Navigating and Comprehending
I was brand new to Clojure when I started this plugin, so stuff that helped me understand code was a top priority.
:FindDoc, which map to the underlying
clojure.replmacro (with tab complete, of course).
Kis mapped to look up the symbol under the cursor with
[dis mapped to look up the symbol under the cursor with
[<C-D>jumps to the definition of a symbol (even if it's inside a jar file).
gf, everybody's favorite "go to file" command, works on namespaces.
Where possible, I favor enhancing built-ins over inventing a bunch of
Because why not? It works in the quasi-REPL too.
Why does it take so long for Vim to startup?
Copyright © Tim Pope. Distributed under the same terms as Vim itself.