Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Vim autocompletion for android developement?

Tags:

android

Refer to: How can I set up Vim for Android development?.

Autocompletion of vim (omnicomplete) is powerful tool of vim, but there was no tags of android library..., how do i set my vim for android development?

like image 334
user700356 Avatar asked Dec 01 '25 04:12

user700356


2 Answers

The most powerful way is using eclim which is an interface to eclipse. Pressing C-x C-u in insert mode shows the auto-completion popup. The drawback is that you have to install the whole eclipse IDE.

If you prefer a slim solution you can use javacomplete. Just set it up as told in the instructions. Then you can use C-x C-o to open the auto-completion popup. To get completion of android classes just add it temporarily to your CLASSPATH environment variable e.g. by starting vim via

CLASSPATH=/opt/android-sdk/platforms/android-2.2/android.jar:$CLASSPATH vim

You might also be interested in Vim JDE a quiet good Java IDE for vim.

like image 70
buergi Avatar answered Dec 03 '25 20:12

buergi


The issue when setting a CLASSPATH with javacomplete is that your tying yourself to a specific target platform, target '9' in buergi's example.

I wrote a small plugin that reads current target and set an appropriate CLASSPATH for current project's target on after 'java' filetype is set.

In order to use it you have to call vim from the project's main directory, or start it whenever you want and then change the working directory to project's root.

Hope it helps.

like image 38
anddam Avatar answered Dec 03 '25 21:12

anddam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!