tags:

views:

502

answers:

9

I love vim, but not having things like IntelliSense/Code completion from Eclipse makes it pretty difficult. I know, I know, I should be able to look at method signatures and java docs for the API I am interested in using. I'd love to, but I'd like it to be accessible from my fingertips instead of having to browse the source tree manually or have a JDK reference handy.

What plugins would make this easier?

A: 

This will be an uphill battle. There is so much knowledge about your program built into Eclipse, that I expect you will eventually have to reimplement it all to be happy.

Any particular reason you cannot just decide you like the built-in editor in Eclipse?

Thorbjørn Ravn Andersen
Because it's terrible and way too heavy for the Java hacking I do. I also like to develop remotely, and having to carry around the IDE on all of my machines really isn't practical.
Nick Stinemates
In my experience the conveniences in a modern Java IDE justifies its size and use of resources. Many people like JetBrains IntelliJ which has just come out in a Community Edition. It might even be runnable over a "ssh -Y..." connection.It appears that a good place to start would be the VIM JDE - http://www.vim.org/scripts/script.php?script_id=1213.
Thorbjørn Ravn Andersen
To contribute my experience: I'm sometimes forced to run Eclipse remotely on my job. With a good local connection it can be run with ssh -XY as Thorbjorn suggests, but from a little further away, i.e. an outside VPN, this feels like playing piano with boxing gloves. However, with TightVNC (or any of its sibling programs) it becomes nearly as zippy as local that I can forget I'm remoting.
Carl Smotricz
+3  A: 

Check out the JDE plugin for Vim. It provides Java omni-completion and a documentation viewer (among other things).

Ayman Hourieh
Have you actually used the JDE plugin? When I tried it, it seemed a bit confused. It doesn't have a very good rating either considering the number of times it's been downloaded.
Benj
I tried it for a while but I don't use it on a day-to-day basis. It looked OK back then.
Ayman Hourieh
Used it a while ago, and it seemed pretty good. There were enough quirks with it that I disabled it and started mousing.
Sam Barnum
Are you saying it was good or it wasn't? You seem to be saying both :-)
Benj
+6  A: 

I tried eclim for a while. It was pretty good, basically it uses eclipse in the background as a kind of engine and provides a plugin to let you use all of eclipses goodness through vim.

http://eclim.sourceforge.net/

Benj
I think eclim even lets you have full blown eclipse running but with vim as a kind of child window inside it. Very impressive really.
Benj
Also check out vrapper. It's a lightweight version. It just enable vim key binding on Eclipse.
Yada
+3  A: 

There's an IntelliJ VIM plugin as well. Plus, IntelliJ is released an open-source, free version.

Sam Barnum
Also IntelliJ is a much nicer editor with smarter completion, re-factoring and intentions support. I have been using the free version for a couple of weeks and its pretty good quality for a beta version. (Some of the previous betas were not so good)
Peter Lawrey
A: 

I agree... vim is great for simpler/less verbose languages but to get work done in java a real IDE is very helpful. And since companies are spending tens of thousands of their dollars developing them you might as well enjoy the results. If you are used to the vi keybindings try to turn on vi-mode in whatever IDE you use ex, jVi for NetBeans

Brandon Thomson
Wasn't the question.
Nick Stinemates
+3  A: 

Vim is not an IDE replacement. But very specific additional tool. With Vim you should only do small-fast tweaks while the main development is going under Netbeans/Eclipse/IDEA.

One more time. It is a Bad Bad Bad idea to turn Vim into Full IDE. Why? It won't be so fast. And thus won't be so pretty.

Here is scenario. You have opened Eclipse or whatever to edit your current task. And in 10 minutes you have to switch to another Task which is kind of urgent. The task is to tweak a little a maven or an ant built script and/or some deployment perl/python/groovy scripts.

How much time will it take to reload Eclipse to work on a new 5 minutes task and switch back?
But if you are Vim guru you can handle this in seconds. You can change one file and run Ant/Mvn within Vim.

And this is the power of Vim. You can change and check one file in no time no matter which extension it has: java, groovy, c++, makefile, bash, c#, etc.

Mykola Golubyev
I agree and disagree so I don't know which way to vote your submission. I have been using NetBeans in conjunction with vim as you say, but only for debugging purposes. Debugging is the one true thing I will open the IDE for (and as such, have it always open..) because even if VI could do it well, I don't think it could do it as well as Eclipse/NetBeans.
Nick Stinemates
Netbeans Good at editing Maven pom files and Refactoring. All searches I do within vim.
Mykola Golubyev
+1  A: 

I use the javacomplete.vim plugin for omni-completion for java. It's a very nice script: it also shows the method signatures on top of the omni-completion. The downside is that it is a bit slow, but it has worked fine for me otherwise. Eclim might be better ut I haven't tried it yet so I can't comment on it.

I've also used the jcommenter.vim plugin for generating javadoc comments. It can parse method signatures and automatically add the relevant @param foo fields and such.

For the API searching I would suggest on overriding the K key on normal mode. It searches man pages for the keyword under the cursor, but the behavior can be overriden by setting the keywordprg variable. See this thread for an example.

Other scripts which I've found very useful (not specific to Java development): NERDCommenter, AutoClose, snipMate, Align.

sluukkonen
A: 

I use Eclipse + Vrapper. Enables the vi dual mode editing we all know and love. <ESC>

Completely free and lightweight. The goal is to have the comfort and ease which comes with the different modes, complex commands and count/operator/motion combinations which are the key features behind editing with Vim, while preserving the powerful features of the different Eclipse text editors, like code generation and refactoring.

While eclim is another alternative, I feel eclim takes over Eclipse and vrapper doesn't.

Yada
+5  A: 

Don't write Java in Vim — put Vim inside a Java IDE:

I love Vim, but using an IDE for Java is the only way to stay sane. A decent Java IDE will:

  • Show invalid syntax or type errors
  • Show missing JavaDoc
  • Manage import statements for you
  • Highlight unused methods and variables
  • Safely perform powerful refactorings such as moving methods or renaming classes -- (no, search and replace doesn't cut it, I promise)
  • Reformat your code automatically or on-demand

Vim can't do the above, but you can use all the Vim keybindings in a program which does.

a paid nerd
I will vouch for jVi. The developer still works on it and is receptive to bug reports and feature requests.
gotgenes