tags:

views:

1119

answers:

8

I have installed vimclojure to make it easier to start learning clojure. But, I haven't been able to setup REPL inside vim. This is essentially because I was not able to write a maplocalleader in vim(?)

Based on the documentation in vimclojure/doc/clojure.txt I put the following in my .vimrc to start the REPL -

:map <LocalLeader>sr *sr* *StartRepl*

But typing "sr" doesn't start the REPL.

Thanks in advance.

+2  A: 

Don't you need to press ,sr? LocalLeader is a comma by default I think.

seth
Thanks. But, I still can't get it to work. I typed ",sr" in the Normal mode of vim.
Bart J
+4  A: 

<LocalLeader> uses value from maplocalleader variable or it is backslash by default. If you do not set maplocalleader variable try \sr

Paul
Also see `:help LocalLeader`
Al
I tried hitting "\sr" in the normal mode too, but the REPL does not get launched. Am I missing something?
Bart J
A: 

Have you tried mapping it to something else? It seems like you aren't sure what LocalLeader is mapped to, so I would recommend changing your mapping.

Niki Yoshiuchi
+3  A: 

I don't have a mapping for sr in my .vimrc, but it works for me.

Have you checked that your Nailgun server is running, and that you have turned on Gorilla?

E.g.,

let clj_want_gorilla = 1
let vimclojure#NailgunClient = "/Users/foo/vimclojure-2.1.0/ng"
Rich
I had a similar problem - I dumbly set the address of the nailgun client to the server rather than client...
Adrian Mouat
A: 

I solved the E10 problem with :set nocompatible. Then the \sr etc. commands worked OK.

Todd Fincannon
+4  A: 

Most likely there is an error occurring in the plugin before the VimClojure mappings are fully defined.

One likely scenario that I have run into several times occurs when the Clojure source file has syntax errors when it's loaded into the Vim buffer.

There's something going on in the plugin during the load of the source file (syntax highlighting or something) that errors out and prevents the mappings from getting defined.

This is probably just an unfortunate issue with VimClojure and should be reported, but I haven't had time to dig enough and log an intelligent bug report/patch.

To troubleshoot, with a Clojure source file open in current buffer, try doing this:

:call vimclojure#Repl.New()

This invokes the function inside the plugin that is mapped to \sr. It's not a recommended way of launching the Repl, but since we're just troubleshooting your configuration, hopefully it will reveal something meaningful to you.

Also, do this to see if there happen to be any helpful messages getting logged.

:messages
Joe Holloway
+2  A: 

I've found that if the NailgunClient cannot be found, VimClojure will fail silently and none of the <LocalLeader> commands will work. I'm basically just repeating Joe Holloway above, but try this to verify that the Nailgun client is actually found:

:call vimclojure#Repl.New()

In my case I forgot to build the client, so I just returned to the unzipped VimClojure folder and ran make. This creates ng, the nailgun client executable. Make sure this is in your PATH somewhere, or set

let vimclojure#NailgunClient = "/Users/foo/vimclojure-2.1.0/ng"

as mentioned above.

overthink
A: 

One can use Conque, a vim plugin that supports running a shell in a vim buffer. I have successfully used it to run a clojure REPL inside vim. It supports split screens, so one can send code from a clojure source code buffer to the clojure REPL.

Huahai Yang