Commend Line Android Development With VIM and Eclim

Eclipse is slow, especially on Macs. Plus, I've never really like IDEs very much. I've always prefer to write my Android projects in the terminal with Vim. Here are some of the basics stuff about developing Android using CLI.

Screen shot 2010-05-09 at 1.17.54 AM

The basics

Some useful commands…

Create projects:

1
android create project —target [ver] —package [x.y.z] —activity [name] —path [dir]

Update your Eclipse projects for CLI deveopment:

1
android update project -p [dir]

Use vim / emacs to write code, and compile / deploy with ant:

1
2
3
ant clean
ant install
ant uninstall

View runtime log:

1
adb log

Eclim

With Eclim you can have most of the Eclipse functionalities inside your vim, including code-completion and real-time validation. Eclim is basically Eclipse running in headless mode that communicates with a vim plugin. So you have your favorite vim for frontend interface, and Eclipse as the backend for different functions.

Screen shot 2010-05-09 at 1.48.11 AM

On the left there's the Project Tree showing all the files in your project, and on the right there are two source code files opened in split view. Installation is pretty simple, same as Eclipse, all major platforms are supported. Run eclimd before executing vim, and use C-x C-u for automatic code completion in vim.

Screen shot 2010-05-09 at 1.25.48 AM

Syntax is also validated in real-time:

Screen shot 2010-05-09 at 1.38.41 AM

Here are some of the basic Eclim commands:

1
2
3
4
5
6
7
:ProjectList
:ProjectOpen [proj]
:ProjectInfo [proj]
:ProjectTree [proj]
:ProjectCD   [proj]  // change directory
:Ant [...]           // compiling and deploying
:Validate

More commands are listed in ~/.vim/eclim/doc/translations/<lang>/vim/cheatsheet.txt Obviously, you need to add your projects to Eclipse in order for this to work, and as Eclipse, Eclim is also not very fast.

Happy hacking~


Comments