Problems with classpath in VimClojore when NAMESPACE is defined

21 views
Skip to first unread message

Starry SHI

unread,
Mar 15, 2014, 8:49:31 AM3/15/14
to vimcl...@googlegroups.com
Hi,

I just switch to use Vim for clojure development. I have VimClojure 2.3.6 and ng-server configured. Small tests work fine. But when I switch to my previous project, where clojure files with namespace defined, I find I cannot look up the functions or docs using VimClojure hotkeys.

e.g. 
project structure:

project.clj
src/myClojureTest/test1.clj

The test1.clj file is like:

(ns myClojureTest.test1
   (:require ....))
(defn func .....)



Then even I just use 
    <LocalLeader>lw 
to check the docs for defn, I got this error:

java.io.FileNotFoundException: Could not locate myClojureTest/test1.class or myClojureTest/test1.clj on classpath 


Also, similar error will be shown when an arbitrary NAME defined in namespace, but the NAME.clj file does not exist:

e.g. in test1.clj:

(ns theTest)
(defn func .....)

Then when I use 
    <LocalLeader>lw 

java.io.FileNotFoundException: Could not locate theTest.class or theTest.clj on classpath 



I do not know how to configure VimClojure to make it recognize the classpath defined in namespace. Please advise :)

guns

unread,
Mar 15, 2014, 5:37:49 PM3/15/14
to vimcl...@googlegroups.com, Starry SHI
On Sat 15 Mar 2014 at 05:49:31AM -0700, Starry SHI wrote:

> I just switch to use Vim for clojure development. I have VimClojure
> 2.3.6 and ng-server configured. Small tests work fine. But when I
> switch to my previous project, where clojure files with namespace
> defined, I find I cannot look up the functions or docs using
> VimClojure hotkeys.

Hi Starry,

Perhaps you haven't placed your source files in the correct location?
It's hard to say without more information (like a file tree and your
classpath).

However, since you are just starting out with Vim and Clojure, you may
want to take a look at Fireplace:

https://github.com/tpope/vim-fireplace

It works quite seamlessly with Leiningen projects, and a large number of
people on this list have migrated to it, so getting help will also be
easier.

guns

Starry SHI

unread,
Mar 15, 2014, 9:21:21 PM3/15/14
to vimcl...@googlegroups.com, Starry SHI
Thank you, guns, for your comments.

The project directory is as follows:

PROJECT_ROOT
    project.clj
    src/myClojureTest/test1.clj

is there any specific configurations in vimclojure to recognize the project directories?

even if I just create a single clojure file, in which I define an arbitrary namespace, VimClojure cannot recognize the ns.

I didn't configure classpath in VimClojure (I do not know how... ). I just put ".", project libraries and clojure.jar in the java classpath.

I will have a try on fireplace when I have time. But I feel it will be better to have vimclojure work too. Anyway, except the namespace issue, everything works fine in vimclojure :)

Meikel Brandmeyer

unread,
Mar 16, 2014, 4:11:13 AM3/16/14
to vimcl...@googlegroups.com
Hi,

On Sat, Mar 15, 2014 at 06:21:21PM -0700, Starry SHI wrote:

> I just put ".", project libraries and clojure.jar in the java
> classpath.

You have to put 'src' on the classpath of your server process. On the
Vim side there is no classpath setting required. However you might want
to put something like "set path+=src" or so in your .vimrc, so that goto
source etc. work.

Hope this helps.

Meikel

--
Meikel Brandmeyer
Clojure Trainings
Kastellstraße 3
63526 Erlensee
http://kotka.de
USt.-Id: DE 285 667 417
signature.asc
Reply all
Reply to author
Forward
0 new messages