How to use vimClojure?

208 views
Skip to first unread message

Dragan Djuric

unread,
Jul 17, 2009, 9:51:00 AM7/17/09
to Clojure
Hi,

I have installed vimClojure and it seems to work, but... how to push
the code to the REPL?
I have defined a function, typed \sr -> REPL started... the fn is not
accessible... tried typinf \ef '\el and their cousins to the vim
command but nothing happens.
I am a notal novice to vim, so the solution is totally simple, but I
hope someone will point a few basic baby steps to us, the eclipsers :)

Meikel Brandmeyer

unread,
Jul 17, 2009, 11:08:52 AM7/17/09
to Clojure
Hi,

On Jul 17, 3:51 pm, Dragan Djuric <draga...@gmail.com> wrote:

> I have installed vimClojure and it seems to work, but... how to push
> the code to the REPL?

Ok. Let's see. Step by step...

0. Start ng-server
1. Start a fresh vim.
2. :setfiletype clojure (a colon command like :w or :q)
3. \sr (should open a new window)
4. <Esc><C-w><C-w> (to go back to first window) (<C-w> is Control+w,
<M-w> would be Alt+w)
5. Type in some function: (defn greet [] (println "Hello, World!"))
6. Make sure the cursor is in the function, eg. on the e of Hello.
7. \et (to send the function to the Repl)
8. A new window should open, containing #'user/greet. Type \p to close
the window.
9. Go to the Repl window, eg. with <C-w><C-w>.
11. At the prompt type (gr and hit <C-x><C-o> to complete the function
name.
10. Submit (greet) by hitting return. (the Repl should now print
"Hello, World!")
12. Have fun toying around.

Note, when you have a file with a ns or in-ns clause at the top,
the file *must* be on the classpath and the file *must* parseable
by clojure without errors!

Hope this helps.

Sincerely
Meikel

Dragan Djuric

unread,
Jul 17, 2009, 4:32:54 PM7/17/09
to Clojure
Thanks! :)

MarkSwanson

unread,
Sep 10, 2009, 12:41:46 AM9/10/09
to Clojure
This doesn't work for me. Here is what happens:
> > 0. Start ng-server
> > 1. Start a fresh vim.
> > 2. :setfiletype clojure (a colon command like :w or :q)
> > 3. \sr (should open a new window)
> > 4. <Esc><C-w><C-w> (to go back to first window) (<C-w> is Control+w,
> > <M-w> would be Alt+w)
> > 5. Type in some function: (defn greet [] (println "Hello, World!"))
> > 6. Make sure the cursor is in the function, eg. on the e of Hello.
> > 7. \et (to send the function to the Repl)
> > 8. A new window should open, containing #'user/greet. Type \p to close
> > the window.

It's all good up to this point.

> > 9. Go to the Repl window, eg. with <C-w><C-w>.
> > 11. At the prompt type (gr and hit <C-x><C-o> to complete the function
> > name.
> > 10. Submit (greet) by hitting return. (the Repl should now print
> > "Hello, World!")

This doesn't work.
The new window opened up containing the right text. However, the REPL
can not use the function.
What's strange is that I can type (gr and CTRL-n and user/greet shows
up! This tells me the REPL has the function, but it gives this error:
#<CompilerException java.lang.IllegalStateException: Var user/greet is
unbound. (REPL:0)>

I've also tried (user/greet) but that doesn't work either - same
error.

I'm using vimclojure-2.1.2 with the latest clojure from git, java 6 on
Ubuntu 9.04.

Note: I have been copying/pasting using a mouse but that has a bug
where comments get an 'x' character put in front of them on paste and
the function won't compile. So I'd really like this to work!

Thanks again for vimclojure!

Meikel Brandmeyer

unread,
Sep 26, 2009, 2:53:43 PM9/26/09
to clo...@googlegroups.com
Hi,

Am 10.09.2009 um 06:41 schrieb MarkSwanson:

>>> 8. A new window should open, containing #'user/greet. Type \p to
>>> close
>>> the window.
>
> It's all good up to this point.
>
>>> 9. Go to the Repl window, eg. with <C-w><C-w>.
>>> 11. At the prompt type (gr and hit <C-x><C-o> to complete the
>>> function
>>> name.
>>> 10. Submit (greet) by hitting return. (the Repl should now print
>>> "Hello, World!")
>
> This doesn't work.
> The new window opened up containing the right text. However, the REPL
> can not use the function.

This is rather strange. If the result window really contains '#'user/
greet, I don't understand, why it is not available at the repl....

> What's strange is that I can type (gr and CTRL-n and user/greet shows
> up! This tells me the REPL has the function, but it gives this error:
> #<CompilerException java.lang.IllegalStateException: Var user/greet is
> unbound. (REPL:0)>

No. <C-n> is completely independent of the Clojure side of VC. It also
works with the dynamic part turned off. It learns all keywords from
all open files. Hence the clojure side is not required as for <C-x><C-
o>.

Sincerely
Meikel

Reply all
Reply to author
Forward
0 new messages