Posts Tagged ‘eclim’

Coding in Java using Vim

November 28, 2009

This is one topic born out of necessity. I had to do it and had a discussion on the vim-use group about it. Since I am lazy, I just cut-paste the conversation instead of summarizing it.

Hi,
I code Java in Vim using Vjde(http://www.vim.org/scripts/script.php?script_id=1213). But I am not able to use many of the features because the documentation is entirely in Chinese, with a brief tutorial in English.
1) While it recognizes standard packages ( java.* ) for code completion, it does not recognize my custom packages. I am following the ctags instructions specified in the script homepage exactly as far as I can understand them.
2) The auto-import feature works for standard packages but not mine.Questions:
1) Is there any other tool for coding Java in Vim other than Vjde?
2) Why am I using vim to code Java instead of Eclipse? Well, I have to code java over a VPN halfway across the world and the bandwidth makes a full fledged Eclipse IDE very slow. My question is, if there was a full fledged java plugin for vim with as many features as Eclipse, wouldn’t it be even slower, since it would have to do the parsing and matching in a language-generic way?

 

Thanks,
Srikanth

> 1) Is there any other tool for coding Java in Vim other than Vjde?

You may want to give a try to eclim (http://eclim.org/) I’ve not used it by myself but some people have told me that it’s good enough.

It requires you to run an instance of eclipse in the background though. Not sure if this poses a problem for the OP.

Marc Weber

Yes, of course vim script is slower than Java. There is one plugin on vim.org which implements a Java parser. However it wasn’t updated within the last year. And I think there are many reasons for it. It is insane to duplicate the work which was done on Eclipse. Eclim probably won’t solve the speed issues for you.

Maybe you can look at your problem in a different way?
Maybe you can implement kind of file caching so that accessing files is faster ?
Maybe you can start using a version control system so that you can keep a local copy of the source code.

Why do you have to use files which are stored on a server having a slow connection to you?
What is your real problem?

Be aware that Netbeans has very good vi keybindings. Eclipse also has a vi-plugin.

Maybe try only reading .java files from the remote location while linking Eclipse stuff to a local disk. Using ntfs you can create different kinds of links etc.

Also be aware that you can’t debug Java code as comfortable as in Eclipse or netbeans. I”d also join #eclipse and ask how others work with a setup like yours.

There are alternative solutions: Eg log into the server and work using a terminal. I don’t know which works best for you. You have to try.

Good luck.
Marc Weber

Hi,
Thanks for all the replies. I didn’t expect so many and so quick.
>> Eclim probably won’t solve the speed issues for you.
Actually it partly did. The background eclipse runs on the server (half the world away) and doesn’t have to transport the entire GUI across the n/w since the frontend s only a terminal vi..

>> log into the server and work using  a terminal.
Exactly what I do.

>>Maybe you can implement kind of file caching so that accessing files is
faster ?
>> Maybe you can start using a version control system so that you can keep
a local copy of the source code.
Uh Oh… This is company code so strictly no checkouts allowed locally (at home). Of course we check out a local copy in the office so there is no problem using Eclipse/Netbeans there. At home, even connecting to the local server is slow.

>>  What is your real problem?
Can’t checkout code at home (officially atleast)
Currently using Eclim at home is sufficient for me, so thanks for all the help. This thread can be closed.

Thanks,
Srikanth