views:

556

answers:

5

I use vim as my editor but I would like to get some of the same power of the IDE's for java when it comes to refactoring. Are there any commandline tools for refactoring java? I could probably hack something together using perl or vim scripting but if there is something already out there I'd rather use that.

A: 

Why not borrow from Eclipse source?

Stephan Eggermont
+2  A: 

Check out jrefactory, and its command line option.

Adeel Ansari
It does almost nothing.
stepancheg
Yeah, not that sophisticated. I use IntelliJ and Netbeans, though.
Adeel Ansari
+1  A: 

Code refactoring is a very context-sensitive and interaction-heavy process which doesn't lend itself very well to command-line interfaces. There can be dozens of types of refactorings you could do to a particular file (or set of files) and coming up with a vim interface to integrate all of this would be a major challenge.

If you want IDE functionality, why not use an IDE? Especially with Java, which lends itself so well to automatic refactoring by a complex piece of software like Eclipse.

levik
A: 

I use sed sometimes.

stepancheg
sounds like work. :)
Adeel Ansari
+1  A: 

I would strongly advise you to use VIM within an IDE (e.g. VIMPlugin and Eclipse - this is the combination I use and it works very well).

I used to be a VIM diehard. However the refactoring and code analysis within a modern IDE will far surpass any capabilities that VIM will provide (with plugins etc.).

Don't get me wrong. I love VIM and still use it for all sorts of stuff. Modern IDEs are the most productive route forward, however.

Brian Agnew
I've tried those but the vim plugin doesn't give me any of the ide benefits. I might as well just use vim and the ide side by side.
Jeremy Wall