ThaDon
ThaDon

Reputation: 8068

Generate imports list for Java File

I'm writing some Java code in vim and really miss the feature afforded by the IDEs such that I can type up a block of code, and after a few keystrokes have the IDE infer which imports it should place at the top of my file based on the classes I've used in my code.

Anyone know of a way to achieve this functionality in vim? I'm thinking a command-line tool I can shell to for the file being edited. The tool would ideally dump the imports to the screen after it's analysed my Java file.

Upvotes: 0

Views: 699

Answers (2)

ThaDon
ThaDon

Reputation: 8068

It seems to boil down to two different approaches, ones like Amir suggested where some process generates a mapping file from classes on the file system, or the approach I ended up taking where the plugin communicates real-time to a process that does the heavy lifting (Eclipse).

So I chose Eclim, seems antithetical to vim's light weight mantra, but in the end was the best featured approach.

Upvotes: 0

Amir Raminfar
Amir Raminfar

Reputation: 34169

You can try these links

http://vim.wikia.com/wiki/Add_Java_import_statements_automatically

Vim & Java: add java import statements automatically

Haven't tried it myself but its a good start.

Upvotes: 1

Related Questions