Samveen's Blog

7th April 2011

thursday
 
Vim on Android

I recently got myself an android based phone (An Aircel India branded Huawei Ideos U8150) and was pretty impressed with it. The fact that I could open a terminal into it and pretty much use it as I would my laptop or Desktop, was mind-blowing to me. Further, as I got it on a lark without looking into the specs of the phone, it felt all the more amazing.

I decided to go for broke and use it as my perl development system. Requirements: A terminal, Perl base, and Vim. The terminal was easy to trace. A simple search on "Best android terminal" through enough lists to convince me that the open source "ConnectBot" was good enough. Getting the package URL on to the phone was the stupid problem, luckily easily solved (steps in Appendix 1). Next came the perl install. After some searching, I found the Scripting Layer for Android or SL4A and got my perl installation up and running. The last and most problematic problem was the install of Vim. After a couple of searches, I found the tarball of compiled binary distribution of Vim at http://gdr.geekhood.net/gdrwpl/vim-android.php . The instructions with the package required root access on the phone. I decided to install it on the sdcard, instead of the recommended location. I created a pseudo-home at /mnt/sdcard/home, created an opt at /mnt/sdcard/opt, extracted the tar's bin and share dirs into it, and started up vim.

To my dismay, it failed to startup.The problem with my method is that the sdcard is always mounted with the option 'noexec'. I did need root access. Thanks to the wonderful app "z4root" by RyanZA (The rageaginsthtecage exploit is amazing and Sebastian Krahmer is a God (http://c-skills.blogspot.com/ ) ), I got myself root access on the phone. First thing is that I remounted the sdcard without 'noexec'. Next, i tried vim. Voila, it worked. With proper guidance in the form of the environment variables TERMINFO and VIMRUNTIME , I got vim up and running like a charm (and full syntax and arrow movement).

Caveats: you need to add perl binary to the path or link to it somehow (Location: /data/data/com.googlecode.perlforandroid/files/perl/perl).

Appendix 1:
Barcode Scanner App from the xzing team (http://code.google.com/p/zxing/) and the QR generator page http://www.barcodesinc.com/generator/qr/ which uses the Google Chart API (alternately http://imagecharteditor.appspot.com/ ). Generate QR of URL/text, scan with barcode scanner app, and you've got it on your phone. A must have application if I ever saw one.

 linkme
<<prev
next>>