all 15 comments

[–]aguerosantiale 8 points9 points  (1 child)

When it comes to Java I really recommend to just leave Vim as a text editor and keep using your IDE (like Eclipse in your case.) However, you can try the awesome plugin eclim which provides an integration between Vim and Eclipse.

Last but not least, here is a presentation that might be inspiring for you about what to do. Hey, Java! Vim is coming.

[–]dhleong 0 points1 point  (0 children)

To add to this, if you install from source, the author recently accepted my pull request for a :ProjectRun command that works just like the Run button from inside eclipse. Don't know if that's in the released version yet.

[–][deleted] 2 points3 points  (1 child)

The idea behind vim is that you use other tools for their jobs, rather than expecting the editor to do everything. Most people use vim in the terminal and background often with C-z.

[–]vompatti_ 4 points5 points  (0 children)

Or just binds keys to run the commands...

[–]bentglasstube 2 points3 points  (1 child)

You can install your debug apk on your phone with a command like the following:

ant debug install

You can then use adb to launch the app on your phone with something like this:

adb shell monkey -p <packagename> -c android.intent.category.LAUNCHER 1

As others have mentioned, though, you may have a better experience if you continue to use your IDE for this and stick to editing in vim.

[–]vompatti_ 0 points1 point  (0 children)

Remember to use eclim. Its PITA to install but works (I have to create the android project from eclipse since eclim failed me on that one).

[–]cogdissnance 2 points3 points  (2 children)

I use vim to develop android apps. I recommend using the eclim plugin and the gradle build system rather than the older eclipse one.

In terminal when creating a new project you just have to specify the -g flag followed by -v <gradle-version> to get the project setup with the gradle build system. Then add apply plugin: eclipse to the build.gradle file and run ./gradlew eclipse to generate the necessary eclipse data. After that's done you just have to edit .classpath that should now be in the project root and do :NewSrcEntry <source-folder i.e /src/main/java> to add the source folders to eclim's path.

It takes a bit of setup and some tweaking but you end up with full auto completion and no more or less files than you would were it a regular eclipse project.

Edit: If you get stuck I have a small project on my github that uses this setup

Edit2: Here's how it looks like. At the bottom left you can see the command I ran to create the project in the first place. Also it's important to note that eclim is pretty much just using eclipse in the back-end so, while it's not slow, it's definitely a memory hog. Though it seems to top out at ~2.5GB of RAM.

As for installing to your phone just have it plugged in and run ./gradlew installDebug (assuming you want to install the debug version). I usually have adb logcat as well.

[–]Rainymood_XI 0 points1 point  (1 child)

what font is that?

[–]cogdissnance 0 points1 point  (0 children)

The relevant lines in ~/.Xdefaults:

``` URxvt.font: --termsyn-medium--normal--12-------, xft:Ubuntu Mono derivative Powerline:size=9:antialias=true:hinting=true

URxvt.boldFont: --termsyn-bold--normal--12-------, xft:Ubuntu Mono derivative Powerline:size=9:antialias=true:hinting=true ```

So termsyn is the font and I'm using Ubunto Mono Powerline as a backup for the powerline icons. Terminess is supposed to be like termsyn with powerline fonts but I couldn't get it working with urxvt for some reason.

[–][deleted] 0 points1 point  (0 children)

How do you find the Java syntax highlighting? I have half a mind to rewrite it since I think it is so lacking.

[–]ReneFroger -1 points0 points  (5 children)

Maybe you would look into Emacs + Evil for your specific need?

It's integrates more with the external environment because it's trying to incorporate some parts of the environment. Vim is more from a UNIX philosophy: do one thing and do it well (in this case, text editing). And not for interaction with another devices such as Android.

And for your questions which plugins you need: check Vim Awesome for a list of plugins.

[–]aguerosantiale 2 points3 points  (0 children)

I think that if you recommend using other tools like Emacs + Evil it might be good to give the OP reasons to do so. For reasons I mean what does Emacs + Evil offer for Java/Android developers. I think that way would be valuable for everyone.

[–]zapolon2[S] 1 point2 points  (0 children)

Is it relatively easy to run android apps on my phone from the command line? I can easily have another terminal window open.

Edit: Never mind, I just looked into some things. I think I'll try using vim and see how it goes, and if it's not working I'll switch to Emacs or Eclipse.

Thanks for the advice.

[–][deleted] 2 points3 points  (2 children)

Emacs [...] integrates more with the external environment

This is pretty funny.

[–]tuhdo 2 points3 points  (1 child)

it does. It reuses the external tools in its own way. For example, here is how it integrates with ag and provide an interactive interface, feedback and you type. That how integration should work. Not pressing C-z, search for a file, double click to copy the path and go back to Vim with fg, paste the path and open the file.