开发者

What are some good plugins for developing Java in VIM?

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 th开发者_StackOverflowis easier?


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.org/


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

  • IdeaVIM for IntelliJ
  • viPlugin or Eclim for Eclipse
  • jVi or ViEx for NetBeans

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.


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.


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


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.


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


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜