How to set Vim autocompletion for android developement?
Refer to: How can I set up Vim for Android development?.
Autocompletion of vim (omnicomplete) is powerfu开发者_Go百科l tool of vim, but there was no tags of android library..., how do i set my vim for android development?
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.
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.
Look github for android plugins, there are a few.
I recommend this plugin: https://github.com/hsanson/vim-android, and yes I wrote it.
精彩评论